mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2024-12-27 08:19:30 +08:00
Merge pull request #3004 from ngosang/cppcheck_fixes
Cppcheck: scope reduction & unused variables
This commit is contained in:
commit
4d848e99f0
@ -79,9 +79,8 @@ RequestParser::ErrorCode RequestParser::parseHttpRequest(const QByteArray& data,
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Parse HTTP request message
|
// Parse HTTP request message
|
||||||
int content_length = 0;
|
|
||||||
if (m_request.headers.contains("content-length")) {
|
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)) {
|
if (content_length > static_cast<int>(m_maxContentLength)) {
|
||||||
qWarning() << Q_FUNC_INFO << "bad request: message too long";
|
qWarning() << Q_FUNC_INFO << "bad request: message too long";
|
||||||
return BadRequest;
|
return BadRequest;
|
||||||
|
@ -145,9 +145,7 @@ void Utils::Misc::shutdownComputer(ShutdownAction action)
|
|||||||
AppleEvent eventReply = {typeNull, NULL};
|
AppleEvent eventReply = {typeNull, NULL};
|
||||||
AppleEvent appleEventToSend = {typeNull, NULL};
|
AppleEvent appleEventToSend = {typeNull, NULL};
|
||||||
|
|
||||||
OSStatus error = noErr;
|
OSStatus error = AECreateDesc(typeProcessSerialNumber, &kPSNOfSystemProcess,
|
||||||
|
|
||||||
error = AECreateDesc(typeProcessSerialNumber, &kPSNOfSystemProcess,
|
|
||||||
sizeof(kPSNOfSystemProcess), &targetDesc);
|
sizeof(kPSNOfSystemProcess), &targetDesc);
|
||||||
|
|
||||||
if (error != noErr)
|
if (error != noErr)
|
||||||
|
@ -118,7 +118,6 @@ void RssFeed::loadItemsFromDisk()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void RssFeed::addArticle(const RssArticlePtr& article) {
|
void RssFeed::addArticle(const RssArticlePtr& article) {
|
||||||
int lbIndex = -1;
|
|
||||||
int max_articles = Preferences::instance()->getRSSMaxArticlesPerFeed();
|
int max_articles = Preferences::instance()->getRSSMaxArticlesPerFeed();
|
||||||
|
|
||||||
if (!m_articles.contains(article->guid())) {
|
if (!m_articles.contains(article->guid())) {
|
||||||
@ -132,7 +131,7 @@ void RssFeed::addArticle(const RssArticlePtr& article) {
|
|||||||
// Insertion sort
|
// Insertion sort
|
||||||
RssArticleList::Iterator lowerBound = qLowerBound(m_articlesByDate.begin(), m_articlesByDate.end(), article, rssArticleDateRecentThan);
|
RssArticleList::Iterator lowerBound = qLowerBound(m_articlesByDate.begin(), m_articlesByDate.end(), article, rssArticleDateRecentThan);
|
||||||
m_articlesByDate.insert(lowerBound, article);
|
m_articlesByDate.insert(lowerBound, article);
|
||||||
lbIndex = m_articlesByDate.indexOf(article);
|
int lbIndex = m_articlesByDate.indexOf(article);
|
||||||
if (m_articlesByDate.size() > max_articles) {
|
if (m_articlesByDate.size() > max_articles) {
|
||||||
RssArticlePtr oldestArticle = m_articlesByDate.takeLast();
|
RssArticlePtr oldestArticle = m_articlesByDate.takeLast();
|
||||||
m_articles.remove(oldestArticle->guid());
|
m_articles.remove(oldestArticle->guid());
|
||||||
|
Loading…
Reference in New Issue
Block a user