mirror of
https://github.com/transmission/transmission.git
synced 2025-12-24 12:28:52 +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:
@@ -357,9 +357,13 @@ void tr_bitfield::set(size_t nth, bool value)
|
|||||||
|
|
||||||
/* Already tested that val != nth bit so just swap */
|
/* Already tested that val != nth bit so just swap */
|
||||||
auto& byte = flags_[nth >> 3U];
|
auto& byte = flags_[nth >> 3U];
|
||||||
|
#ifdef TR_ENABLE_ASSERTS
|
||||||
auto const old_byte_pop = doPopcount(byte);
|
auto const old_byte_pop = doPopcount(byte);
|
||||||
|
#endif
|
||||||
byte ^= 0x80 >> (nth & 7U);
|
byte ^= 0x80 >> (nth & 7U);
|
||||||
|
#ifdef TR_ENABLE_ASSERTS
|
||||||
auto const new_byte_pop = doPopcount(byte);
|
auto const new_byte_pop = doPopcount(byte);
|
||||||
|
#endif
|
||||||
|
|
||||||
if (value)
|
if (value)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -376,7 +376,7 @@ size_t BlocklistFile::setContent(char const* filename)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef TR_ENABLE_ASSERTS
|
#ifdef TR_ENABLE_ASSERTS
|
||||||
void BlocklistFile::assertValidRules(std::vector<IPv4Range>& ranges)
|
void BlocklistFile::assertValidRules(std::vector<IPv4Range> const& ranges)
|
||||||
{
|
{
|
||||||
for (auto const& r : ranges)
|
for (auto const& r : ranges)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -111,7 +111,7 @@ private:
|
|||||||
|
|
||||||
#ifdef TR_ENABLE_ASSERTS
|
#ifdef TR_ENABLE_ASSERTS
|
||||||
/// @brief Sanity checks: make sure the rules are sorted in ascending order and don't overlap
|
/// @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
|
#endif
|
||||||
|
|
||||||
bool is_enabled_;
|
bool is_enabled_;
|
||||||
|
|||||||
@@ -100,10 +100,12 @@ struct tr_rpc_address
|
|||||||
|
|
||||||
static int constexpr DeflateLevel = 6; // medium / default
|
static int constexpr DeflateLevel = 6; // medium / default
|
||||||
|
|
||||||
|
#ifdef TR_ENABLE_ASSERTS
|
||||||
static bool constexpr tr_rpc_address_is_valid(tr_rpc_address const& a)
|
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;
|
return a.type == TR_RPC_AF_INET || a.type == TR_RPC_AF_INET6 || a.type == TR_RPC_AF_UNIX;
|
||||||
}
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
/***
|
/***
|
||||||
****
|
****
|
||||||
|
|||||||
@@ -235,6 +235,7 @@ private:
|
|||||||
****
|
****
|
||||||
***/
|
***/
|
||||||
|
|
||||||
|
// NOLINTNEXTLINE(cppcoreguidelines-avoid-non-const-global-variables)
|
||||||
int DetailsDialog::prev_tab_index_ = 0;
|
int DetailsDialog::prev_tab_index_ = 0;
|
||||||
|
|
||||||
DetailsDialog::DetailsDialog(Session& session, Prefs& prefs, TorrentModel const& model, QWidget* parent)
|
DetailsDialog::DetailsDialog(Session& session, Prefs& prefs, TorrentModel const& model, QWidget* parent)
|
||||||
|
|||||||
@@ -426,10 +426,10 @@ QMenu* MainWindow::createOptionsMenu()
|
|||||||
|
|
||||||
menu->addSeparator();
|
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)));
|
auto* const action = menu->addAction(Formatter::get().speedToString(Speed::fromKBps(kps)));
|
||||||
action->setProperty(PrefVariantsKey, QVariantList{ pref, KBps, enabled_pref, true });
|
action->setProperty(PrefVariantsKey, QVariantList{ pref, kps, enabled_pref, true });
|
||||||
connect(action, &QAction::triggered, this, qOverload<>(&MainWindow::onSetPrefs));
|
connect(action, &QAction::triggered, this, qOverload<>(&MainWindow::onSetPrefs));
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -66,7 +66,7 @@ protected:
|
|||||||
|
|
||||||
TEST_F(BlocklistTest, parsing)
|
TEST_F(BlocklistTest, parsing)
|
||||||
{
|
{
|
||||||
EXPECT_EQ(0, tr_blocklistGetRuleCount(session_));
|
EXPECT_EQ(0U, tr_blocklistGetRuleCount(session_));
|
||||||
|
|
||||||
// init the blocklist
|
// init the blocklist
|
||||||
auto const path = tr_pathbuf{ tr_sessionGetConfigDir(session_), "/blocklists/level1" };
|
auto const path = tr_pathbuf{ tr_sessionGetConfigDir(session_), "/blocklists/level1" };
|
||||||
|
|||||||
Reference in New Issue
Block a user