From eb7a844099ac30e6e65b7458880bc8b7c5109a84 Mon Sep 17 00:00:00 2001 From: Christophe Dumez Date: Sat, 17 Mar 2012 17:23:45 +0200 Subject: [PATCH] Code clean up --- src/misc.h | 8 -------- src/qtlibtorrent/qbtsession.cpp | 4 ++-- 2 files changed, 2 insertions(+), 10 deletions(-) diff --git a/src/misc.h b/src/misc.h index f2a6b96e5..24cb4cc78 100644 --- a/src/misc.h +++ b/src/misc.h @@ -90,14 +90,6 @@ public: return tmp.join("/"); } - static inline libtorrent::sha1_hash QStringToSha1(const QString& s) { - std::string str(s.toAscii().data()); - std::istringstream i(str); - libtorrent::sha1_hash x; - i>>x; - return x; - } - static inline QString file_extension(const QString &filename) { QString extension; int point_index = filename.lastIndexOf("."); diff --git a/src/qtlibtorrent/qbtsession.cpp b/src/qtlibtorrent/qbtsession.cpp index 515deebb3..ec232883d 100644 --- a/src/qtlibtorrent/qbtsession.cpp +++ b/src/qtlibtorrent/qbtsession.cpp @@ -779,7 +779,7 @@ void QBtSession::useAlternativeSpeedsLimit(bool alternative) { // Return the torrent handle, given its hash QTorrentHandle QBtSession::getTorrentHandle(const QString &hash) const{ - return QTorrentHandle(s->find_torrent(misc::QStringToSha1(hash))); + return QTorrentHandle(s->find_torrent(QStringToSha1(hash))); } bool QBtSession::hasActiveTorrents() const { @@ -963,7 +963,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed) { Q_ASSERT(magnet_uri.startsWith("magnet:", Qt::CaseInsensitive)); // Check for duplicate torrent - if(s->find_torrent(misc::QStringToSha1(hash)).is_valid()) { + if(s->find_torrent(QStringToSha1(hash)).is_valid()) { qDebug("/!\\ Torrent is already in download list"); addConsoleMessage(tr("'%1' is already in download list.", "e.g: 'xxx.avi' is already in download list.").arg(magnet_uri)); return h;