diff --git a/rak/socket_address.h b/rak/socket_address.h index db4f4db35..69d9ad94a 100644 --- a/rak/socket_address.h +++ b/rak/socket_address.h @@ -359,14 +359,12 @@ socket_address::set_address_c_str(const char* a) { if (sa_inet()->set_address_c_str(a)) { sa_inet()->set_family(); return true; - - } else if (sa_inet6()->set_address_c_str(a)) { + } + if (sa_inet6()->set_address_c_str(a)) { sa_inet6()->set_family(); return true; - - } else { - return false; } + return false; } // Is the zero length really needed, should we require some length? diff --git a/rak/string_manip.h b/rak/string_manip.h index 6be1afac2..ffd4004c3 100644 --- a/rak/string_manip.h +++ b/rak/string_manip.h @@ -171,11 +171,10 @@ hexchar_to_value(char c) { if (c >= '0' && c <= '9') return c - '0'; - else if (c >= 'A' && c <= 'F') + if (c >= 'A' && c <= 'F') return 10 + c - 'A'; - - else - return 10 + c - 'a'; + + return 10 + c - 'a'; } template @@ -186,8 +185,7 @@ value_to_hexchar(Value v) { if (v < 0xA) return '0' + v; - else - return 'A' + v - 0xA; + return 'A' + v - 0xA; } template @@ -218,12 +216,20 @@ copy_escape_html(InputIterator first1, InputIterator last1, OutputIterator first if (std::isalpha(*first1, std::locale::classic()) || std::isdigit(*first1, std::locale::classic()) || *first1 == '-') { - if (first2 == last2) break; else *(first2++) = *first1; + if (first2 == last2) + break; + *(first2++) = *first1; } else { - if (first2 == last2) break; else *(first2++) = '%'; - if (first2 == last2) break; else *(first2++) = value_to_hexchar<1>(*first1); - if (first2 == last2) break; else *(first2++) = value_to_hexchar<0>(*first1); + if (first2 == last2) + break; + *(first2++) = '%'; + if (first2 == last2) + break; + *(first2++) = value_to_hexchar<1>(*first1); + if (first2 == last2) + break; + *(first2++) = value_to_hexchar<0>(*first1); } ++first1; @@ -277,8 +283,12 @@ template OutputIterator transform_hex(InputIterator first1, InputIterator last1, OutputIterator first2, OutputIterator last2) { while (first1 != last1) { - if (first2 == last2) break; else *(first2++) = value_to_hexchar<1>(*first1); - if (first2 == last2) break; else *(first2++) = value_to_hexchar<0>(*first1); + if (first2 == last2) + break; + *(first2++) = value_to_hexchar<1>(*first1); + if (first2 == last2) + break; + *(first2++) = value_to_hexchar<0>(*first1); ++first1; } diff --git a/src/data/chunk_list.cc b/src/data/chunk_list.cc index 3130c7d72..9b9e011e5 100644 --- a/src/data/chunk_list.cc +++ b/src/data/chunk_list.cc @@ -364,19 +364,15 @@ ChunkList::sync_options(ChunkListNode* node, int flags) { if (flags & sync_safe) return std::make_pair(MemoryChunk::sync_sync, true); - else - return std::make_pair(MemoryChunk::sync_async, true); + return std::make_pair(MemoryChunk::sync_async, true); + } + if (flags & sync_safe) { - } else if (flags & sync_safe) { - if (node->sync_triggered()) return std::make_pair(MemoryChunk::sync_sync, true); - else - return std::make_pair(MemoryChunk::sync_async, false); - - } else { - return std::make_pair(MemoryChunk::sync_async, true); + return std::make_pair(MemoryChunk::sync_async, false); } + return std::make_pair(MemoryChunk::sync_async, true); } // Using a rather simple algorithm for now. This should really be more diff --git a/src/data/hash_torrent.cc b/src/data/hash_torrent.cc index 8411a6447..0c35212b8 100644 --- a/src/data/hash_torrent.cc +++ b/src/data/hash_torrent.cc @@ -159,7 +159,8 @@ HashTorrent::queue(bool quick) { if (itr == m_ranges.end()) { m_position = m_chunk_list->size(); break; - } else if (m_position < itr->first) { + } + if (m_position < itr->first) { m_position = itr->first; } diff --git a/src/dht/dht_router.cc b/src/dht/dht_router.cc index 067c1e2a3..cd74dc920 100644 --- a/src/dht/dht_router.cc +++ b/src/dht/dht_router.cc @@ -208,8 +208,7 @@ DhtRouter::get_node(const HashString& id) { if (itr == m_nodes.end()) { if (id == this->id()) return this; - else - return NULL; + return NULL; } return itr.node(); diff --git a/src/dht/dht_server.cc b/src/dht/dht_server.cc index 34474c624..5c3af82ef 100644 --- a/src/dht/dht_server.cc +++ b/src/dht/dht_server.cc @@ -693,14 +693,12 @@ DhtServer::failed_transaction(transaction_itr itr, bool quick) { } if (quick) { - return ++itr; // don't actually delete the transaction until the final timeout - - } else { - drop_packet(transaction->packet()); - delete itr->second; - m_transactions.erase(itr++); - return itr; + return ++itr; // don't actually delete the transaction until the final timeout } + drop_packet(transaction->packet()); + delete itr->second; + m_transactions.erase(itr++); + return itr; } void diff --git a/src/dht/dht_tracker.cc b/src/dht/dht_tracker.cc index 7ea653304..7d0fb4b22 100644 --- a/src/dht/dht_tracker.cc +++ b/src/dht/dht_tracker.cc @@ -58,8 +58,8 @@ DhtTracker::add_peer(uint32_t addr, uint16_t port) { m_peers[i].peer.port = compact.port; m_lastSeen[i] = cachedTime.seconds(); return; - - } else if (m_lastSeen[i] < minSeen) { + } + if (m_lastSeen[i] < minSeen) { minSeen = m_lastSeen[i]; oldest = i; } diff --git a/src/download/chunk_selector.cc b/src/download/chunk_selector.cc index 81fd65059..402465e9e 100644 --- a/src/download/chunk_selector.cc +++ b/src/download/chunk_selector.cc @@ -253,8 +253,7 @@ ChunkSelector::search_linear_range(const Bitfield* bf, rak::partial_queue* pq, u if (wanted) return search_linear_byte(pq, m_data->untouched_bitfield()->position(local), wanted); - else - return true; + return true; } // Take pointer to partial_queue diff --git a/src/net/socket_fd.cc b/src/net/socket_fd.cc index c36ff4b93..1e453b059 100644 --- a/src/net/socket_fd.cc +++ b/src/net/socket_fd.cc @@ -72,8 +72,7 @@ SocketFd::set_priority(priority_type p) { if (m_ipv6_socket) return setsockopt(m_fd, IPPROTO_IPV6, IPV6_TCLASS, &opt, sizeof(opt)) == 0; - else - return setsockopt(m_fd, IPPROTO_IP, IP_TOS, &opt, sizeof(opt)) == 0; + return setsockopt(m_fd, IPPROTO_IP, IP_TOS, &opt, sizeof(opt)) == 0; } bool diff --git a/src/net/socket_stream.cc b/src/net/socket_stream.cc index 011aa850e..808999a4e 100644 --- a/src/net/socket_stream.cc +++ b/src/net/socket_stream.cc @@ -64,12 +64,11 @@ SocketStream::read_stream_throws(void* buf, uint32_t length) { if (r < 0) { if (rak::error_number::current().is_blocked_momentary()) return 0; - else if (rak::error_number::current().is_closed()) + if (rak::error_number::current().is_closed()) throw close_connection(); - else if (rak::error_number::current().is_blocked_prolonged()) + if (rak::error_number::current().is_blocked_prolonged()) throw blocked_connection(); - else - throw connection_error(rak::error_number::current().value()); + throw connection_error(rak::error_number::current().value()); } return r; @@ -85,12 +84,11 @@ SocketStream::write_stream_throws(const void* buf, uint32_t length) { if (r < 0) { if (rak::error_number::current().is_blocked_momentary()) return 0; - else if (rak::error_number::current().is_closed()) + if (rak::error_number::current().is_closed()) throw close_connection(); - else if (rak::error_number::current().is_blocked_prolonged()) + if (rak::error_number::current().is_blocked_prolonged()) throw blocked_connection(); - else - throw connection_error(rak::error_number::current().value()); + throw connection_error(rak::error_number::current().value()); } return r; diff --git a/src/net/throttle_list.cc b/src/net/throttle_list.cc index 34393309a..9e66a3a20 100644 --- a/src/net/throttle_list.cc +++ b/src/net/throttle_list.cc @@ -162,18 +162,16 @@ ThrottleList::node_quota(ThrottleNode* node) { // Returns max for signed integer to ensure we don't overflow // claculations. return std::numeric_limits::max(); - - } else if (!is_active(node)) { + } + if (!is_active(node)) { throw internal_error(is_inactive(node) ? "ThrottleList::node_quota(...) called on an inactive node." : "ThrottleList::node_quota(...) could not find node."); - - } else if (node->quota() + m_unallocatedQuota >= m_minChunkSize) { + } + if (node->quota() + m_unallocatedQuota >= m_minChunkSize) { return node->quota() + m_unallocatedQuota; - - } else { - return 0; } + return 0; } void diff --git a/src/protocol/peer_connection_base.cc b/src/protocol/peer_connection_base.cc index 5c71fc312..ef4e7f59c 100644 --- a/src/protocol/peer_connection_base.cc +++ b/src/protocol/peer_connection_base.cc @@ -942,14 +942,13 @@ PeerConnectionBase::should_request() { // || m_down->get_state() == ProtocolRead::READ_SKIP_PIECE) return false; - else if (!m_download->delegator()->get_aggressive()) + if (!m_download->delegator()->get_aggressive()) return true; - else - // We check if the peer is stalled, if it is not then we should - // request. If the peer is stalled then we only request if the - // download rate is below a certain value. - return m_downStall <= 1 || m_download->info()->down_rate()->rate() < (10 << 10); + // We check if the peer is stalled, if it is not then we should + // request. If the peer is stalled then we only request if the + // download rate is below a certain value. + return m_downStall <= 1 || m_download->info()->down_rate()->rate() < (10 << 10); } bool diff --git a/src/protocol/peer_connection_leech.cc b/src/protocol/peer_connection_leech.cc index 52acad42b..82a128cd1 100644 --- a/src/protocol/peer_connection_leech.cc +++ b/src/protocol/peer_connection_leech.cc @@ -188,15 +188,15 @@ PeerConnection::read_message() { m_down->set_last_command(ProtocolBase::KEEP_ALIVE); return true; - - } else if (buf->remaining() < 1) { + } + if (buf->remaining() < 1) { buf->set_position_itr(beginning); return false; - - } else if (length > (1 << 20)) { + } + if (length > (1 << 20)) { throw communication_error("PeerConnection::read_message() got an invalid message length."); } - + // We do not verify the message length of those with static // length. A bug in the remote client causing the message start to // be unsyncronized would in practically all cases be caught with @@ -293,26 +293,19 @@ PeerConnection::read_message() { m_tryRequest = true; down_chunk_finished(); return true; - - } else { - m_down->set_state(ProtocolRead::READ_SKIP_PIECE); - m_down->throttle()->insert(m_peerChunks.download_throttle()); - return false; } - - } else { - + m_down->set_state(ProtocolRead::READ_SKIP_PIECE); + m_down->throttle()->insert(m_peerChunks.download_throttle()); + return false; + } if (down_chunk_from_buffer()) { m_tryRequest = true; down_chunk_finished(); return true; - - } else { - m_down->set_state(ProtocolRead::READ_PIECE); - m_down->throttle()->insert(m_peerChunks.download_throttle()); - return false; } - } + m_down->set_state(ProtocolRead::READ_PIECE); + m_down->throttle()->insert(m_peerChunks.download_throttle()); + return false; case ProtocolBase::CANCEL: if (!m_down->can_read_cancel_body()) @@ -401,10 +394,9 @@ PeerConnection::event_read() { if (m_down->buffer()->size_end() == read_size) { m_down->buffer()->move_unused(); break; - } else { - m_down->buffer()->move_unused(); - return; } + m_down->buffer()->move_unused(); + return; case ProtocolRead::READ_PIECE: if (type != Download::CONNECTION_LEECH) diff --git a/src/protocol/peer_connection_metadata.cc b/src/protocol/peer_connection_metadata.cc index 539ceb4c1..1072ac587 100644 --- a/src/protocol/peer_connection_metadata.cc +++ b/src/protocol/peer_connection_metadata.cc @@ -116,15 +116,15 @@ PeerConnectionMetadata::read_message() { m_down->set_last_command(ProtocolBase::KEEP_ALIVE); return true; - - } else if (buf->remaining() < 1) { + } + if (buf->remaining() < 1) { buf->set_position_itr(beginning); return false; - - } else if (length > (1 << 20)) { + } + if (length > (1 << 20)) { throw communication_error("PeerConnection::read_message() got an invalid message length."); } - + m_down->set_last_command((ProtocolBase::Protocol)buf->peek_8()); // Ignore most messages, they aren't relevant for a metadata download. @@ -251,10 +251,9 @@ PeerConnectionMetadata::event_read() { if (m_down->buffer()->size_end() == read_size) { m_down->buffer()->move_unused(); break; - } else { - m_down->buffer()->move_unused(); - return; } + m_down->buffer()->move_unused(); + return; case ProtocolRead::READ_EXTENSION: if (!down_extension()) @@ -449,10 +448,9 @@ PeerConnectionMetadata::try_request_metadata_pieces() { if (m_extensions->request_metadata_piece(p)) { LT_LOG_METADATA_EVENTS("request metadata piece succeded", 0); return true; - } else { - LT_LOG_METADATA_EVENTS("request metadata piece failed", 0); - return false; } + LT_LOG_METADATA_EVENTS("request metadata piece failed", 0); + return false; } void diff --git a/src/protocol/request_list.cc b/src/protocol/request_list.cc index f10bd7fbd..587cffb6a 100644 --- a/src/protocol/request_list.cc +++ b/src/protocol/request_list.cc @@ -342,15 +342,11 @@ RequestList::calculate_pipe_size(uint32_t rate) { if (!m_delegator->get_aggressive()) { if (rate < 20) return rate + 2; - else - return rate / 5 + 18; - - } else { - if (rate < 10) - return rate / 5 + 1; - else - return rate / 10 + 2; + return rate / 5 + 18; } + if (rate < 10) + return rate / 5 + 1; + return rate / 10 + 2; } } diff --git a/src/thread_main.cc b/src/thread_main.cc index a8e9d3157..5d553bcdb 100644 --- a/src/thread_main.cc +++ b/src/thread_main.cc @@ -57,8 +57,7 @@ thread_main::next_timeout_usec() { if (!taskScheduler.empty()) return std::max(taskScheduler.top()->time() - cachedTime, rak::timer()).usec(); - else - return rak::timer::from_seconds(60).usec(); + return rak::timer::from_seconds(60).usec(); } } diff --git a/src/torrent/connection_manager.cc b/src/torrent/connection_manager.cc index ea5efc589..dba526dba 100644 --- a/src/torrent/connection_manager.cc +++ b/src/torrent/connection_manager.cc @@ -176,8 +176,7 @@ uint32_t ConnectionManager::filter(const sockaddr* sa) { if (!m_slot_filter) return 1; - else - return m_slot_filter(sa); + return m_slot_filter(sa); } bool diff --git a/src/torrent/data/block.cc b/src/torrent/data/block.cc index 70572db6a..af22a8483 100644 --- a/src/torrent/data/block.cc +++ b/src/torrent/data/block.cc @@ -193,13 +193,11 @@ Block::transfering(BlockTransfer* transfer) { if (m_leader != NULL) { transfer->set_state(BlockTransfer::STATE_NOT_LEADER); return false; - - } else { - m_leader = transfer; - - transfer->set_state(BlockTransfer::STATE_LEADER); - return true; } + m_leader = transfer; + + transfer->set_state(BlockTransfer::STATE_LEADER); + return true; } // TODO: Don't depend on m_leader for access to block transfer data of @@ -392,8 +390,7 @@ Block::find_queued(const PeerInfo* p) { if (itr == m_queued.end()) return NULL; - else - return *itr; + return *itr; } const BlockTransfer* @@ -402,8 +399,7 @@ Block::find_queued(const PeerInfo* p) const { if (itr == m_queued.end()) return NULL; - else - return *itr; + return *itr; } BlockTransfer* @@ -412,8 +408,7 @@ Block::find_transfer(const PeerInfo* p) { if (itr == m_transfers.end()) return NULL; - else - return *itr; + return *itr; } const BlockTransfer* @@ -422,8 +417,7 @@ Block::find_transfer(const PeerInfo* p) const { if (itr == m_transfers.end()) return NULL; - else - return *itr; + return *itr; } } diff --git a/src/torrent/data/file_list.cc b/src/torrent/data/file_list.cc index c221fa910..a4e1b32ca 100644 --- a/src/torrent/data/file_list.cc +++ b/src/torrent/data/file_list.cc @@ -104,13 +104,11 @@ FileList::completed_bytes() const { // The last chunk is not done, or the last chunk is the same size // as the others. return completed_chunks() * cs; - - } else { - if (completed_chunks() == 0) - throw internal_error("FileList::bytes_completed() completed_chunks() == 0.", data()->hash()); - - return (completed_chunks() - 1) * cs + size_bytes() % cs; } + if (completed_chunks() == 0) + throw internal_error("FileList::bytes_completed() completed_chunks() == 0.", data()->hash()); + + return (completed_chunks() - 1) * cs + size_bytes() % cs; } uint64_t @@ -130,8 +128,7 @@ uint32_t FileList::chunk_index_size(uint32_t index) const { if (index + 1 != size_chunks() || size_bytes() % chunk_size() == 0) return chunk_size(); - else - return size_bytes() % chunk_size(); + return size_bytes() % chunk_size(); } void diff --git a/src/torrent/download/choke_queue.cc b/src/torrent/download/choke_queue.cc index ea9fe272e..d66b70a73 100644 --- a/src/torrent/download/choke_queue.cc +++ b/src/torrent/download/choke_queue.cc @@ -57,8 +57,7 @@ inline uint32_t choke_queue::max_alternate() const { if (m_currently_unchoked < 31) return (m_currently_unchoked + 7) / 8; - else - return (m_currently_unchoked + 9) / 10; + return (m_currently_unchoked + 9) / 10; } group_stats diff --git a/src/torrent/download/download_manager.cc b/src/torrent/download/download_manager.cc index d6089d9ca..db9bbfa9d 100644 --- a/src/torrent/download/download_manager.cc +++ b/src/torrent/download/download_manager.cc @@ -98,8 +98,7 @@ DownloadManager::find_main(const char* hash) { if (itr == end()) return NULL; - else - return (*itr)->main(); + return (*itr)->main(); } DownloadMain* @@ -109,8 +108,7 @@ DownloadManager::find_main_obfuscated(const char* hash) { if (itr == end()) return NULL; - else - return (*itr)->main(); + return (*itr)->main(); } } diff --git a/src/torrent/peer/client_info.cc b/src/torrent/peer/client_info.cc index cd17e0e13..5b7cd5b5a 100644 --- a/src/torrent/peer/client_info.cc +++ b/src/torrent/peer/client_info.cc @@ -74,7 +74,7 @@ bool ClientInfo::less_intersects(const ClientInfo& left, const ClientInfo& right) { if (left.type() > right.type()) return false; - else if (left.type() < right.type()) + if (left.type() < right.type()) return true; int keyComp = std::memcmp(left.key(), right.key(), ClientInfo::max_key_size); @@ -88,7 +88,7 @@ bool ClientInfo::less_disjoint(const ClientInfo& left, const ClientInfo& right) { if (left.type() > right.type()) return false; - else if (left.type() < right.type()) + if (left.type() < right.type()) return true; int keyComp = std::memcmp(left.key(), right.key(), ClientInfo::max_key_size); diff --git a/src/torrent/peer/peer.cc b/src/torrent/peer/peer.cc index e924e67b1..435f0cf11 100644 --- a/src/torrent/peer/peer.cc +++ b/src/torrent/peer/peer.cc @@ -83,11 +83,10 @@ Peer::transfer() const { if (c_ptr()->request_list()->transfer() != NULL) return c_ptr()->request_list()->transfer(); - else if (!c_ptr()->request_list()->queued_empty()) + if (!c_ptr()->request_list()->queued_empty()) return c_ptr()->request_list()->queued_front(); - else - return NULL; + return NULL; } void diff --git a/src/torrent/peer/peer_list.cc b/src/torrent/peer/peer_list.cc index e3ffe20d1..534897f78 100644 --- a/src/torrent/peer/peer_list.cc +++ b/src/torrent/peer/peer_list.cc @@ -33,21 +33,19 @@ socket_address_less(const sockaddr* s1, const sockaddr* s2) { if (sa1->family() != sa2->family()) { return sa1->family() < sa2->family(); - - } else if (sa1->family() == rak::socket_address::af_inet) { + } + if (sa1->family() == rak::socket_address::af_inet) { // Sort by hardware byte order to ensure proper ordering for // humans. return sa1->sa_inet()->address_h() < sa2->sa_inet()->address_h(); - - } else if (sa1->family() == rak::socket_address::af_inet6) { + } + if (sa1->family() == rak::socket_address::af_inet6) { const in6_addr addr1 = sa1->sa_inet6()->address(); const in6_addr addr2 = sa2->sa_inet6()->address(); return memcmp(&addr1, &addr2, sizeof(in6_addr)) < 0; - - } else { - throw internal_error("socket_address_key(...) tried to compare an invalid family type."); } + throw internal_error("socket_address_key(...) tried to compare an invalid family type."); } // @@ -319,8 +317,7 @@ PeerList::disconnected(PeerInfo* p, int flags) { if (itr == range.second) { if (std::none_of(base_type::begin(), base_type::end(), [p](auto& v){ return p == v.second; })) throw internal_error("PeerList::disconnected(...) itr == range.second, doesn't exist."); - else - throw internal_error("PeerList::disconnected(...) itr == range.second, not in the range."); + throw internal_error("PeerList::disconnected(...) itr == range.second, not in the range."); } disconnected(itr, flags); diff --git a/src/torrent/poll_select.cc b/src/torrent/poll_select.cc index 543433935..e3038041c 100644 --- a/src/torrent/poll_select.cc +++ b/src/torrent/poll_select.cc @@ -49,9 +49,8 @@ struct poll_check_t { thread_base::waive_global_lock(); return true; - } else { - return false; } + return false; } Poll* m_poll; diff --git a/src/torrent/throttle.cc b/src/torrent/throttle.cc index d8c5c5595..b0b5924dc 100644 --- a/src/torrent/throttle.cc +++ b/src/torrent/throttle.cc @@ -117,23 +117,22 @@ Throttle::calculate_min_chunk_size() const { if (m_maxRate <= (8 << 10)) return (1 << 9); - else if (m_maxRate <= (32 << 10)) + if (m_maxRate <= (32 << 10)) return (2 << 9); - else if (m_maxRate <= (64 << 10)) + if (m_maxRate <= (64 << 10)) return (3 << 9); - else if (m_maxRate <= (128 << 10)) + if (m_maxRate <= (128 << 10)) return (4 << 9); - else if (m_maxRate <= (512 << 10)) + if (m_maxRate <= (512 << 10)) return (8 << 9); - else if (m_maxRate <= (2048 << 10)) + if (m_maxRate <= (2048 << 10)) return (16 << 9); - else - return (32 << 9); + return (32 << 9); } uint32_t @@ -154,10 +153,9 @@ Throttle::calculate_interval() const { if (interval == 0) return 1 * 100000; - else if (interval > 10) + if (interval > 10) return 10 * 100000; - else - return interval * 100000; + return interval * 100000; } } diff --git a/src/torrent/torrent.cc b/src/torrent/torrent.cc index dbdb69714..315edfd46 100644 --- a/src/torrent/torrent.cc +++ b/src/torrent/torrent.cc @@ -31,28 +31,28 @@ uint32_t calculate_max_open_files(uint32_t openMax) { if (openMax >= 8096) return 256; - else if (openMax >= 1024) + if (openMax >= 1024) return 128; - else if (openMax >= 512) + if (openMax >= 512) return 64; - else if (openMax >= 128) + if (openMax >= 128) return 16; - else // Assumes we don't try less than 64. - return 4; + // Assumes we don't try less than 64. + return 4; } uint32_t calculate_reserved(uint32_t openMax) { if (openMax >= 8096) return 256; - else if (openMax >= 1024) + if (openMax >= 1024) return 128; - else if (openMax >= 512) + if (openMax >= 512) return 64; - else if (openMax >= 128) + if (openMax >= 128) return 32; - else // Assumes we don't try less than 64. - return 16; + // Assumes we don't try less than 64. + return 16; } void diff --git a/src/torrent/utils/option_strings.cc b/src/torrent/utils/option_strings.cc index 453f3de99..ab620183b 100644 --- a/src/torrent/utils/option_strings.cc +++ b/src/torrent/utils/option_strings.cc @@ -280,8 +280,7 @@ option_to_string_or_throw(option_enum opt_enum, unsigned int value, const char* if (result == NULL) throw input_error(not_found); - else - return result; + return result; } const char* @@ -290,8 +289,7 @@ option_as_string(option_enum opt_enum, unsigned int value) { if (result == NULL) throw input_error("Invalid option value."); - else - return result; + return result; } torrent::Object diff --git a/src/torrent/utils/resume.cc b/src/torrent/utils/resume.cc index d04ac8aa7..1ae8ec3b9 100644 --- a/src/torrent/utils/resume.cc +++ b/src/torrent/utils/resume.cc @@ -423,10 +423,8 @@ resume_check_target_files(Download download, [[maybe_unused]] const Object& obje return true; - } else { - // We consider empty file lists as being valid. - return fileList->empty() || fileList->front()->is_created(); - } + } // We consider empty file lists as being valid. + return fileList->empty() || fileList->front()->is_created(); } void