mirror of
https://github.com/qbittorrent/qBittorrent.git
synced 2026-01-01 05:08:05 -06:00
Don't use 'else' after return/break
This commit is contained in:
@@ -177,9 +177,8 @@ int FilterParserThread::parseDATFilterFile()
|
||||
memmove(buffer.data(), buffer.data() + start, offset);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
++nbLine;
|
||||
}
|
||||
|
||||
++nbLine;
|
||||
|
||||
if ((buffer[start] == '#')
|
||||
|| ((buffer[start] == '/') && ((start + 1 < dataSize) && (buffer[start + 1] == '/')))) {
|
||||
@@ -325,9 +324,8 @@ int FilterParserThread::parseP2PFilterFile()
|
||||
memmove(buffer.data(), buffer.data() + start, offset);
|
||||
break;
|
||||
}
|
||||
else {
|
||||
++nbLine;
|
||||
}
|
||||
|
||||
++nbLine;
|
||||
|
||||
if ((buffer[start] == '#')
|
||||
|| ((buffer[start] == '/') && ((start + 1 < dataSize) && (buffer[start + 1] == '/')))) {
|
||||
|
||||
@@ -59,12 +59,12 @@ TrackerEntry::Status TrackerEntry::status() const
|
||||
// true when the tracker hasn't been tried yet.
|
||||
if (m_nativeEntry.verified && m_nativeEntry.is_working())
|
||||
return Working;
|
||||
else if ((m_nativeEntry.fails == 0) && m_nativeEntry.updating)
|
||||
if ((m_nativeEntry.fails == 0) && m_nativeEntry.updating)
|
||||
return Updating;
|
||||
else if (m_nativeEntry.fails == 0)
|
||||
if (m_nativeEntry.fails == 0)
|
||||
return NotContacted;
|
||||
else
|
||||
return NotWorking;
|
||||
|
||||
return NotWorking;
|
||||
}
|
||||
|
||||
void TrackerEntry::setTier(const int value)
|
||||
|
||||
@@ -178,7 +178,7 @@ QString GeoIPDatabase::lookup(const QHostAddress &hostAddr) const
|
||||
if (id == m_nodeCount) {
|
||||
return QString();
|
||||
}
|
||||
else if (id > m_nodeCount) {
|
||||
if (id > m_nodeCount) {
|
||||
QString country = m_countries.value(id);
|
||||
if (country.isEmpty()) {
|
||||
const quint32 offset = id - m_nodeCount - sizeof(DATA_SECTION_SEPARATOR);
|
||||
@@ -191,9 +191,8 @@ QString GeoIPDatabase::lookup(const QHostAddress &hostAddr) const
|
||||
}
|
||||
return country;
|
||||
}
|
||||
else {
|
||||
ptr = m_data + (id * m_nodeSize);
|
||||
}
|
||||
|
||||
ptr = m_data + (id * m_nodeSize);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -205,7 +204,7 @@ if (!metadata.contains(#key)) { \
|
||||
error = errMsgNotFound.arg(#key); \
|
||||
return false; \
|
||||
} \
|
||||
else if (metadata.value(#key).userType() != QMetaType::type) { \
|
||||
if (metadata.value(#key).userType() != QMetaType::type) { \
|
||||
error = errMsgInvalid.arg(#key); \
|
||||
return false; \
|
||||
}
|
||||
|
||||
@@ -556,22 +556,20 @@ void Parser::parse_impl(const QByteArray &feedData)
|
||||
foundChannel = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
qDebug() << "Skip rss item: " << xml.name();
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
|
||||
qDebug() << "Skip rss item: " << xml.name();
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
break;
|
||||
}
|
||||
else if (xml.name() == "feed") { // Atom feed
|
||||
if (xml.name() == "feed") { // Atom feed
|
||||
parseAtomChannel(xml);
|
||||
foundChannel = true;
|
||||
break;
|
||||
}
|
||||
else {
|
||||
qDebug() << "Skip root item: " << xml.name();
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
|
||||
qDebug() << "Skip root item: " << xml.name();
|
||||
xml.skipCurrentElement();
|
||||
}
|
||||
|
||||
if (!foundChannel) {
|
||||
|
||||
@@ -81,8 +81,8 @@ QString Item::joinPath(const QString &path1, const QString &path2)
|
||||
{
|
||||
if (path1.isEmpty())
|
||||
return path2;
|
||||
else
|
||||
return path1 + Item::PathSeparator + path2;
|
||||
|
||||
return (path1 + Item::PathSeparator + path2);
|
||||
}
|
||||
|
||||
QStringList Item::expandPath(const QString &path)
|
||||
|
||||
@@ -174,19 +174,22 @@ bool TorrentFilter::matchState(const BitTorrent::TorrentHandle *const torrent) c
|
||||
bool TorrentFilter::matchHash(const BitTorrent::TorrentHandle *const torrent) const
|
||||
{
|
||||
if (m_hashSet == AnyHash) return true;
|
||||
else return m_hashSet.contains(torrent->hash());
|
||||
|
||||
return m_hashSet.contains(torrent->hash());
|
||||
}
|
||||
|
||||
bool TorrentFilter::matchCategory(const BitTorrent::TorrentHandle *const torrent) const
|
||||
{
|
||||
if (m_category.isNull()) return true;
|
||||
else return (torrent->belongsToCategory(m_category));
|
||||
|
||||
return (torrent->belongsToCategory(m_category));
|
||||
}
|
||||
|
||||
bool TorrentFilter::matchTag(const BitTorrent::TorrentHandle *const torrent) const
|
||||
{
|
||||
// Empty tag is a special value to indicate we're filtering for untagged torrents.
|
||||
if (m_tag.isNull()) return true;
|
||||
else if (m_tag.isEmpty()) return torrent->tags().isEmpty();
|
||||
else return (torrent->hasTag(m_tag));
|
||||
if (m_tag.isEmpty()) return torrent->tags().isEmpty();
|
||||
|
||||
return (torrent->hasTag(m_tag));
|
||||
}
|
||||
|
||||
@@ -285,8 +285,8 @@ int Utils::Misc::friendlyUnitPrecision(SizeUnit unit)
|
||||
// friendlyUnit's number of digits after the decimal point
|
||||
if (unit == SizeUnit::Byte) return 0;
|
||||
if (unit <= SizeUnit::MebiByte) return 1;
|
||||
else if (unit == SizeUnit::GibiByte) return 2;
|
||||
else return 3;
|
||||
if (unit == SizeUnit::GibiByte) return 2;
|
||||
return 3;
|
||||
}
|
||||
|
||||
qlonglong Utils::Misc::sizeInBytes(qreal size, Utils::Misc::SizeUnit unit)
|
||||
|
||||
Reference in New Issue
Block a user