1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-25 01:03:01 +00:00

fix: compiler warnings (#3123)

* fix: unused function warning tr_rpc_address_is_valid

* fix: unused variable warning old_byte_pop

* fix: method-can-be-made-static warning assertValidRules

* fix: signed-unsigned comparison warning

* fix: invalid case style warning for KBps

* chore: disable warning for static class member varaible
This commit is contained in:
Charles Kerr 2022-05-22 21:22:34 -05:00 committed by GitHub
parent c0bb2d40f1
commit 67a078402d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
7 changed files with 13 additions and 6 deletions

View file

@ -357,9 +357,13 @@ void tr_bitfield::set(size_t nth, bool value)
/* Already tested that val != nth bit so just swap */
auto& byte = flags_[nth >> 3U];
#ifdef TR_ENABLE_ASSERTS
auto const old_byte_pop = doPopcount(byte);
#endif
byte ^= 0x80 >> (nth & 7U);
#ifdef TR_ENABLE_ASSERTS
auto const new_byte_pop = doPopcount(byte);
#endif
if (value)
{

View file

@ -376,7 +376,7 @@ size_t BlocklistFile::setContent(char const* filename)
}
#ifdef TR_ENABLE_ASSERTS
void BlocklistFile::assertValidRules(std::vector<IPv4Range>& ranges)
void BlocklistFile::assertValidRules(std::vector<IPv4Range> const& ranges)
{
for (auto const& r : ranges)
{

View file

@ -111,7 +111,7 @@ private:
#ifdef TR_ENABLE_ASSERTS
/// @brief Sanity checks: make sure the rules are sorted in ascending order and don't overlap
void assertValidRules(std::vector<IPv4Range>& ranges);
static void assertValidRules(std::vector<IPv4Range> const& ranges);
#endif
bool is_enabled_;

View file

@ -100,10 +100,12 @@ struct tr_rpc_address
static int constexpr DeflateLevel = 6; // medium / default
#ifdef TR_ENABLE_ASSERTS
static bool constexpr tr_rpc_address_is_valid(tr_rpc_address const& a)
{
return a.type == TR_RPC_AF_INET || a.type == TR_RPC_AF_INET6 || a.type == TR_RPC_AF_UNIX;
}
#endif
/***
****

View file

@ -235,6 +235,7 @@ private:
****
***/
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
int DetailsDialog::prev_tab_index_ = 0;
DetailsDialog::DetailsDialog(Session& session, Prefs& prefs, TorrentModel const& model, QWidget* parent)

View file

@ -426,10 +426,10 @@ QMenu* MainWindow::createOptionsMenu()
menu->addSeparator();
for (auto const KBps : { 50, 100, 250, 500, 1000, 2500, 5000, 10000 })
for (auto const kps : { 50, 100, 250, 500, 1000, 2500, 5000, 10000 })
{
auto* const action = menu->addAction(Formatter::get().speedToString(Speed::fromKBps(KBps)));
action->setProperty(PrefVariantsKey, QVariantList{ pref, KBps, enabled_pref, true });
auto* const action = menu->addAction(Formatter::get().speedToString(Speed::fromKBps(kps)));
action->setProperty(PrefVariantsKey, QVariantList{ pref, kps, enabled_pref, true });
connect(action, &QAction::triggered, this, qOverload<>(&MainWindow::onSetPrefs));
}
};

View file

@ -66,7 +66,7 @@ protected:
TEST_F(BlocklistTest, parsing)
{
EXPECT_EQ(0, tr_blocklistGetRuleCount(session_));
EXPECT_EQ(0U, tr_blocklistGetRuleCount(session_));
// init the blocklist
auto const path = tr_pathbuf{ tr_sessionGetConfigDir(session_), "/blocklists/level1" };