mirror of
https://github.com/transmission/transmission.git
synced 2025-12-20 02:18:42 +00:00
refactor: remove unused vars, code simplify and minor optimize (#4172)
This commit is contained in:
@@ -144,10 +144,11 @@ void tr_bandwidth::allocateBandwidth(
|
||||
tr_priority_t const priority = std::max(parent_priority, this->priority_);
|
||||
|
||||
/* set the available bandwidth */
|
||||
if (this->band_[dir].is_limited_)
|
||||
auto bandwidth = &this->band_[dir];
|
||||
if (bandwidth->is_limited_)
|
||||
{
|
||||
uint64_t const next_pulse_speed = this->band_[dir].desired_speed_bps_;
|
||||
this->band_[dir].bytes_left_ = next_pulse_speed * period_msec / 1000U;
|
||||
uint64_t const next_pulse_speed = bandwidth->desired_speed_bps_;
|
||||
bandwidth->bytes_left_ = next_pulse_speed * period_msec / 1000U;
|
||||
}
|
||||
|
||||
/* add this bandwidth's peer, if any, to the peer pool */
|
||||
|
||||
@@ -111,8 +111,6 @@ void BaseWatchdir::processFile(std::string_view basename)
|
||||
|
||||
void BaseWatchdir::scan()
|
||||
{
|
||||
auto new_dir_entries = std::set<std::string>{};
|
||||
|
||||
tr_error* error = nullptr;
|
||||
auto const dir = tr_sys_dir_open(dirname_.c_str(), &error);
|
||||
if (dir == TR_BAD_SYS_DIR)
|
||||
|
||||
@@ -65,7 +65,7 @@ QIcon IconCache::guessMimeIcon(QString const& filename, QIcon fallback) const
|
||||
|
||||
if (icon.isNull())
|
||||
{
|
||||
icon = fallback;
|
||||
icon = std::move(fallback);
|
||||
}
|
||||
|
||||
return icon;
|
||||
|
||||
@@ -197,7 +197,6 @@ bool isValidUtf8(QByteArray const& byteArray)
|
||||
|
||||
auto const* const codec = QTextCodec::codecForName("UTF-8");
|
||||
auto state = QTextCodec::ConverterState{};
|
||||
auto const text = codec->toUnicode(byteArray.constData(), byteArray.size(), &state);
|
||||
return state.invalidChars == 0;
|
||||
|
||||
#endif
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
|
||||
#include "StyleHelper.h"
|
||||
|
||||
QIcon::Mode StyleHelper::getIconMode(QStyle::State state)
|
||||
QIcon::Mode StyleHelper::getIconMode(QStyle::State const& state)
|
||||
{
|
||||
if (!state.testFlag(QStyle::State_Enabled))
|
||||
{
|
||||
|
||||
@@ -11,5 +11,5 @@
|
||||
class StyleHelper
|
||||
{
|
||||
public:
|
||||
static QIcon::Mode getIconMode(QStyle::State state);
|
||||
static QIcon::Mode getIconMode(QStyle::State const& state);
|
||||
};
|
||||
|
||||
@@ -112,9 +112,7 @@ private:
|
||||
tr_sha1_digest_t data_ = {};
|
||||
|
||||
public:
|
||||
TorrentHash()
|
||||
{
|
||||
}
|
||||
TorrentHash() = default;
|
||||
|
||||
explicit TorrentHash(tr_sha1_digest_t const& data)
|
||||
: data_{ data }
|
||||
|
||||
@@ -93,8 +93,6 @@ TEST(MagnetMetainfo, magnetParse)
|
||||
|
||||
TEST(WebUtilsTest, parseMagnetFuzzRegressions)
|
||||
{
|
||||
auto buf = std::vector<char>{};
|
||||
|
||||
static auto constexpr Tests = std::array<std::string_view, 1>{
|
||||
"UICOl7RLjChs/QZZwNH4sSQwuH890UMHuoxoWBmMkr0=",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user