From 3eb61cfe83b4e2379980b8186ce910dade4f8207 Mon Sep 17 00:00:00 2001 From: ngosang Date: Thu, 14 May 2015 13:22:36 +0200 Subject: [PATCH] Cppcheck: scope reduction & unused variables --- src/core/http/requestparser.cpp | 3 +-- src/core/utils/misc.cpp | 4 +--- src/gui/rss/rssfeed.cpp | 3 +-- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/src/core/http/requestparser.cpp b/src/core/http/requestparser.cpp index 4a766a900..8c20df0d2 100644 --- a/src/core/http/requestparser.cpp +++ b/src/core/http/requestparser.cpp @@ -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(m_maxContentLength)) { qWarning() << Q_FUNC_INFO << "bad request: message too long"; return BadRequest; diff --git a/src/core/utils/misc.cpp b/src/core/utils/misc.cpp index 89f21dae2..77c98c57c 100644 --- a/src/core/utils/misc.cpp +++ b/src/core/utils/misc.cpp @@ -145,9 +145,7 @@ void Utils::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) diff --git a/src/gui/rss/rssfeed.cpp b/src/gui/rss/rssfeed.cpp index b0e7df0d0..b7ae8a8db 100644 --- a/src/gui/rss/rssfeed.cpp +++ b/src/gui/rss/rssfeed.cpp @@ -118,7 +118,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())) { @@ -132,7 +131,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());