1
0
mirror of https://github.com/d47081/qBittorrent.git synced 2025-01-27 23:14:31 +00:00

Merge pull request #1238 from botanegg/cppcheck

Corrections from running cppcheck.
This commit is contained in:
sledgehammer999 2014-01-04 15:07:48 -08:00
commit ab89edb589
5 changed files with 8 additions and 9 deletions

View File

@ -964,7 +964,7 @@ QTorrentHandle QBtSession::addMagnetUri(QString magnet_uri, bool resumed, bool f
// Adding torrent to Bittorrent session
try {
h = QTorrentHandle(s->add_torrent(p));
}catch(std::exception e) {
}catch(std::exception &e) {
qDebug("Error: %s", e.what());
}
// Check if it worked
@ -1153,7 +1153,7 @@ QTorrentHandle QBtSession::addTorrent(QString path, bool fromScanDir, QString fr
// Adding torrent to Bittorrent session
try {
h = QTorrentHandle(s->add_torrent(p));
}catch(std::exception e) {
}catch(std::exception &e) {
qDebug("Error: %s", e.what());
}
// Check if it worked
@ -1539,7 +1539,7 @@ bool QBtSession::enableDHT(bool b) {
s->add_dht_router(std::make_pair(std::string("dht.aelitis.com"), 6881)); // Vuze
DHTEnabled = true;
qDebug("DHT enabled");
}catch(std::exception e) {
}catch(std::exception &e) {
qDebug("Could not enable DHT, reason: %s", e.what());
return false;
}
@ -1594,7 +1594,7 @@ void QBtSession::saveTempFastResumeData() {
if (h.state() == torrent_status::checking_files || h.state() == torrent_status::queued_for_checking || h.has_error()) continue;
qDebug("Saving fastresume data for %s", qPrintable(h.name()));
h.save_resume_data();
}catch(std::exception e) {}
}catch(std::exception &e) {}
}
}

View File

@ -257,7 +257,7 @@ QStringList QTorrentHandle::url_seeds() const {
qDebug("URL Seed: %s", it->c_str());
res << misc::toQString(*it);
}
} catch(std::exception e) {
} catch(std::exception &e) {
std::cout << "ERROR: Failed to convert the URL seed" << std::endl;
}
return res;

View File

@ -106,7 +106,7 @@ QVariantHash RssDownloadRule::toVariantHash() const
return hash;
}
bool RssDownloadRule::operator==(const RssDownloadRule &other) {
bool RssDownloadRule::operator==(const RssDownloadRule &other) const {
return m_name == other.name();
}

View File

@ -67,7 +67,7 @@ public:
inline void setUseRegex(bool enabled) { m_useRegex = enabled; }
QStringList findMatchingArticles(const RssFeedPtr& feed) const;
// Operators
bool operator==(const RssDownloadRule &other);
bool operator==(const RssDownloadRule &other) const;
private:
QString m_name;

View File

@ -272,10 +272,9 @@ QByteArray Smtp::encode_mime_header(const QString& key, const QString& value, QT
// The text cannot be losslessly encoded as Latin-1. Therefore, we
// must use base64 encoding.
QByteArray utf8 = value.toUtf8();
int ct = utf8.length();
// Use base64 encoding
QByteArray base64 = utf8.toBase64();
ct = base64.length();
int ct = base64.length();
line += "=?utf-8?b?";
for (int i = 0; i < ct; i += 4) {
/*if (line.length() > 72) {