Skip to content

Commit

Permalink
Address clang-tidy-18 warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
non-det-alle committed Nov 18, 2024
1 parent 7377e2b commit ee04065
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion model/end-device-lorawan-mac.cc
Original file line number Diff line number Diff line change
Expand Up @@ -752,7 +752,7 @@ EndDeviceLorawanMac::OnLinkAdrReq(uint8_t dataRate,
{
if (chMask & 0b1 << i) // all enabled by chMask, even if it was invalid
{
if (auto c = channels.at(i); c) // exists
if (const auto& c = channels.at(i); c) // exists
{
if (dataRate >= c->GetMinimumDataRate() &&
dataRate <= c->GetMaximumDataRate())
Expand Down
12 changes: 6 additions & 6 deletions test/lorawan-test-suite.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1730,7 +1730,7 @@ MacCommandTest::DoRun()
auto channels = m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
for (size_t i = 0; i < channels.size(); i++)
{
auto c = channels.at(i + 16 * chMaskCntl);
const auto& c = channels.at(i + 16 * chMaskCntl);
bool actual = (c) ? c->IsEnabledForUplink() : false;
bool expected = (chMask & 0b1 << i);
NS_TEST_EXPECT_MSG_EQ(actual, expected, "Channel " << i << " state != chMask");
Expand Down Expand Up @@ -1765,7 +1765,7 @@ MacCommandTest::DoRun()
auto channels = m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
for (size_t i = 0; i < channels.size(); i++)
{
auto c = channels.at(i + 16 * chMaskCntl);
const auto& c = channels.at(i + 16 * chMaskCntl);
bool actual = (c) ? c->IsEnabledForUplink() : false;
bool expected = (chMask & 0b1 << i);
NS_TEST_EXPECT_MSG_EQ(actual, expected, "Channel " << i << " state != chMask");
Expand Down Expand Up @@ -1799,7 +1799,7 @@ MacCommandTest::DoRun()
auto channels = m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
for (size_t i = 0; i < channels.size(); i++)
{
auto c = channels.at(i + 16 * chMaskCntl);
const auto& c = channels.at(i + 16 * chMaskCntl);
bool actual = (c) ? c->IsEnabledForUplink() : false;
bool expected = (uint16_t(0b111) & 0b1 << i);
NS_TEST_EXPECT_MSG_EQ(actual, expected, "Channel " << i << " state != default");
Expand Down Expand Up @@ -1833,7 +1833,7 @@ MacCommandTest::DoRun()
auto channels = m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
for (size_t i = 0; i < channels.size(); i++)
{
auto c = channels.at(i + 16 * chMaskCntl);
const auto& c = channels.at(i + 16 * chMaskCntl);
bool actual = (c) ? c->IsEnabledForUplink() : false;
bool expected = (uint16_t(0b111) & 0b1 << i);
NS_TEST_EXPECT_MSG_EQ(actual, expected, "Channel " << i << " state != default");
Expand Down Expand Up @@ -1872,7 +1872,7 @@ MacCommandTest::DoRun()
"m_nbTrans expected to be default value");
for (size_t i = 0; i < channels.size(); i++)
{
auto c = channels.at(i);
const auto& c = channels.at(i);
bool actual = (c) ? c->IsEnabledForUplink() : false;
bool expected = (uint16_t(0b111) & 0b1 << i);
NS_TEST_EXPECT_MSG_EQ(actual, expected, "Channel " << i << " state != default");
Expand Down Expand Up @@ -2011,7 +2011,7 @@ MacCommandTest::DoRun()
auto channels = m_mac->GetLogicalLoraChannelHelper()->GetRawChannelArray();
for (size_t i = 0; i < channels.size(); i++)
{
auto c = channels.at(i);
const auto& c = channels.at(i);
if (i > 2)
{
NS_TEST_ASSERT_MSG_EQ(c, nullptr, "Channel " << i << "expected to be nullptr");
Expand Down

0 comments on commit ee04065

Please sign in to comment.