mirror of
https://github.com/espressif/openthread.git
synced 2026-08-18 08:29:52 +00:00
[clang-tidy] add modernize-loop-convert (#8361)
This commit is contained in:
@@ -135,6 +135,7 @@ readonly OT_CLANG_TIDY_CHECKS="\
|
||||
google-explicit-constructor,\
|
||||
google-readability-casting,\
|
||||
misc-unused-using-decls,\
|
||||
modernize-loop-convert,\
|
||||
modernize-use-bool-literals,\
|
||||
modernize-use-equals-default,\
|
||||
modernize-use-equals-delete,\
|
||||
|
||||
@@ -1028,10 +1028,8 @@ void Mac::BeginTransmit(void)
|
||||
// copy the frame into correct `TxFrame` for each radio type
|
||||
// (if it is not already prepared).
|
||||
|
||||
for (uint8_t index = 0; index < GetArrayLength(RadioTypes::kAllRadioTypes); index++)
|
||||
for (RadioType radio : RadioTypes::kAllRadioTypes)
|
||||
{
|
||||
RadioType radio = RadioTypes::kAllRadioTypes[index];
|
||||
|
||||
if (txFrames.GetSelectedRadioTypes().Contains(radio))
|
||||
{
|
||||
TxFrame &txFrame = txFrames.GetTxFrame(radio);
|
||||
@@ -1047,10 +1045,8 @@ void Mac::BeginTransmit(void)
|
||||
// process security for each radio type separately. This
|
||||
// allows radio links to handle security differently, e.g.,
|
||||
// with different keys or link frame counters.
|
||||
for (uint8_t index = 0; index < GetArrayLength(RadioTypes::kAllRadioTypes); index++)
|
||||
for (RadioType radio : RadioTypes::kAllRadioTypes)
|
||||
{
|
||||
RadioType radio = RadioTypes::kAllRadioTypes[index];
|
||||
|
||||
if (txFrames.GetSelectedRadioTypes().Contains(radio))
|
||||
{
|
||||
ProcessTransmitSecurity(txFrames.GetTxFrame(radio));
|
||||
|
||||
@@ -111,14 +111,14 @@ void Address::ExtractFromIp6Address(uint8_t aPrefixLength, const Ip6::Address &a
|
||||
|
||||
ip6Index = aPrefixLength / CHAR_BIT;
|
||||
|
||||
for (uint8_t i = 0; i < Ip4::Address::kSize; i++)
|
||||
for (uint8_t &i : mFields.m8)
|
||||
{
|
||||
if (ip6Index == kSkipIndex)
|
||||
{
|
||||
ip6Index++;
|
||||
}
|
||||
|
||||
mFields.m8[i] = aIp6Address.GetBytes()[ip6Index++];
|
||||
i = aIp6Address.GetBytes()[ip6Index++];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -366,9 +366,9 @@ template <> otError NcpBase::HandlePropertyGet<SPINEL_PROP_THREAD_DUA_ID>(void)
|
||||
}
|
||||
else
|
||||
{
|
||||
for (size_t i = 0; i < sizeof(otIp6InterfaceIdentifier); i++)
|
||||
for (uint8_t i : iid->mFields.m8)
|
||||
{
|
||||
SuccessOrExit(error = mEncoder.WriteUint8(iid->mFields.m8[i]));
|
||||
SuccessOrExit(error = mEncoder.WriteUint8(i));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -388,9 +388,9 @@ template <> otError NcpBase::HandlePropertySet<SPINEL_PROP_THREAD_DUA_ID>(void)
|
||||
{
|
||||
otIp6InterfaceIdentifier iid;
|
||||
|
||||
for (size_t i = 0; i < sizeof(otIp6InterfaceIdentifier); i++)
|
||||
for (uint8_t &i : iid.mFields.m8)
|
||||
{
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(iid.mFields.m8[i]));
|
||||
SuccessOrExit(error = mDecoder.ReadUint8(i));
|
||||
}
|
||||
|
||||
SuccessOrExit(error = otThreadSetFixedDuaInterfaceIdentifier(mInstance, &iid));
|
||||
|
||||
Reference in New Issue
Block a user