mirror of
https://github.com/qbittorrent/qBittorrent
synced 2025-08-22 06:13:36 -07:00
Merge pull request #3180 from ngosang/cppcheck_fixes_32x
Cppcheck: scope reduction & unused variables (v3_2_x)
This commit is contained in:
commit
718983a4d6
4 changed files with 12 additions and 17 deletions
|
@ -79,9 +79,8 @@ RequestParser::ErrorCode RequestParser::parseHttpRequest(const QByteArray& data,
|
|||
}
|
||||
|
||||
// Parse HTTP request message
|
||||
int content_length = 0;
|
||||
if (m_request.headers.contains("content-length")) {
|
||||
content_length = m_request.headers["content-length"].toInt();
|
||||
int content_length = m_request.headers["content-length"].toInt();
|
||||
if (content_length > static_cast<int>(m_maxContentLength)) {
|
||||
qWarning() << Q_FUNC_INFO << "bad request: message too long";
|
||||
return BadRequest;
|
||||
|
|
|
@ -183,9 +183,7 @@ void misc::shutdownComputer(shutDownAction action)
|
|||
AppleEvent eventReply = {typeNull, NULL};
|
||||
AppleEvent appleEventToSend = {typeNull, NULL};
|
||||
|
||||
OSStatus error = noErr;
|
||||
|
||||
error = AECreateDesc(typeProcessSerialNumber, &kPSNOfSystemProcess,
|
||||
OSStatus error = AECreateDesc(typeProcessSerialNumber, &kPSNOfSystemProcess,
|
||||
sizeof(kPSNOfSystemProcess), &targetDesc);
|
||||
|
||||
if (error != noErr)
|
||||
|
|
|
@ -1253,9 +1253,9 @@ void QBtSession::loadTorrentTempData(QTorrentHandle &h, QString savePath, bool m
|
|||
|
||||
// Update file names
|
||||
const QStringList files_path = TorrentTempData::getFilesPath(hash);
|
||||
bool force_recheck = false;
|
||||
QDir base_dir(h.save_path());
|
||||
if (files_path.size() == h.num_files()) {
|
||||
bool force_recheck = false;
|
||||
for (int i=0; i<h.num_files(); ++i) {
|
||||
const QString &path = files_path.at(i);
|
||||
if (!force_recheck && base_dir.exists(path))
|
||||
|
@ -2209,15 +2209,7 @@ void QBtSession::handleTorrentFinishedAlert(libtorrent::torrent_finished_alert*
|
|||
qDebug("Emitting finishedTorrent() signal");
|
||||
emit finishedTorrent(h);
|
||||
qDebug("Received finished alert for %s", qPrintable(h.name()));
|
||||
#ifndef DISABLE_GUI
|
||||
bool will_shutdown = (pref->shutdownWhenDownloadsComplete() ||
|
||||
pref->shutdownqBTWhenDownloadsComplete() ||
|
||||
pref->suspendWhenDownloadsComplete() ||
|
||||
pref->hibernateWhenDownloadsComplete())
|
||||
&& !hasDownloadingTorrents();
|
||||
#else
|
||||
bool will_shutdown = false;
|
||||
#endif
|
||||
|
||||
// AutoRun program
|
||||
if (pref->isAutoRunEnabled())
|
||||
autoRunExternalProgram(h);
|
||||
|
@ -2227,8 +2219,15 @@ void QBtSession::handleTorrentFinishedAlert(libtorrent::torrent_finished_alert*
|
|||
// Mail notification
|
||||
if (pref->isMailNotificationEnabled())
|
||||
sendNotificationEmail(h);
|
||||
|
||||
#ifndef DISABLE_GUI
|
||||
// Auto-Shutdown
|
||||
bool will_shutdown = (pref->shutdownWhenDownloadsComplete() ||
|
||||
pref->shutdownqBTWhenDownloadsComplete() ||
|
||||
pref->suspendWhenDownloadsComplete() ||
|
||||
pref->hibernateWhenDownloadsComplete())
|
||||
&& !hasDownloadingTorrents();
|
||||
|
||||
if (will_shutdown) {
|
||||
bool suspend = pref->suspendWhenDownloadsComplete();
|
||||
bool hibernate = pref->hibernateWhenDownloadsComplete();
|
||||
|
|
|
@ -117,7 +117,6 @@ void RssFeed::loadItemsFromDisk()
|
|||
}
|
||||
|
||||
void RssFeed::addArticle(const RssArticlePtr& article) {
|
||||
int lbIndex = -1;
|
||||
int max_articles = Preferences::instance()->getRSSMaxArticlesPerFeed();
|
||||
|
||||
if (!m_articles.contains(article->guid())) {
|
||||
|
@ -131,7 +130,7 @@ void RssFeed::addArticle(const RssArticlePtr& article) {
|
|||
// Insertion sort
|
||||
RssArticleList::Iterator lowerBound = qLowerBound(m_articlesByDate.begin(), m_articlesByDate.end(), article, rssArticleDateRecentThan);
|
||||
m_articlesByDate.insert(lowerBound, article);
|
||||
lbIndex = m_articlesByDate.indexOf(article);
|
||||
int lbIndex = m_articlesByDate.indexOf(article);
|
||||
if (m_articlesByDate.size() > max_articles) {
|
||||
RssArticlePtr oldestArticle = m_articlesByDate.takeLast();
|
||||
m_articles.remove(oldestArticle->guid());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue