mirror of
https://github.com/espressif/openthread.git
synced 2026-08-04 09:57:47 +00:00
[nits] unify size_t type for local variable when OT_ARRAY_LENGTH is used (#4894)
This commit is contained in:
+2
-1
@@ -3902,7 +3902,8 @@ void Interpreter::ProcessLine(char *aBuf, uint16_t aBufLength, Server &aServer)
|
||||
{
|
||||
char * aArgs[kMaxArgs] = {NULL};
|
||||
char * cmd;
|
||||
uint8_t aArgsLength = 0, i = 0;
|
||||
uint8_t aArgsLength = 0;
|
||||
size_t i = 0;
|
||||
|
||||
mServer = &aServer;
|
||||
|
||||
|
||||
@@ -191,7 +191,7 @@ otError Dataset::Process(uint8_t aArgsLength, char *aArgs[])
|
||||
ExitNow(error = Print(sDataset));
|
||||
}
|
||||
|
||||
for (unsigned int i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
|
||||
{
|
||||
if (strcmp(aArgs[0], sCommands[i].mName) == 0)
|
||||
{
|
||||
@@ -209,7 +209,7 @@ otError Dataset::ProcessHelp(uint8_t aArgsLength, char *aArgs[])
|
||||
OT_UNUSED_VARIABLE(aArgsLength);
|
||||
OT_UNUSED_VARIABLE(aArgs);
|
||||
|
||||
for (unsigned int i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
|
||||
{
|
||||
mInterpreter.mServer->OutputFormat("%s\r\n", sCommands[i].mName);
|
||||
}
|
||||
|
||||
+1
-1
@@ -60,7 +60,7 @@ otError UdpExample::ProcessHelp(uint8_t aArgsLength, char *aArgs[])
|
||||
OT_UNUSED_VARIABLE(aArgsLength);
|
||||
OT_UNUSED_VARIABLE(aArgs);
|
||||
|
||||
for (unsigned int i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(sCommands); i++)
|
||||
{
|
||||
mInterpreter.mServer->OutputFormat("%s\r\n", sCommands[i].mName);
|
||||
}
|
||||
|
||||
@@ -76,7 +76,7 @@ void Dhcp6Client::UpdateAddresses(void)
|
||||
NetworkData::OnMeshPrefixConfig config;
|
||||
|
||||
// remove addresses directly if prefix not valid in network data
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); i++)
|
||||
{
|
||||
IdentityAssociation &ia = mIdentityAssociations[i];
|
||||
|
||||
@@ -123,7 +123,7 @@ void Dhcp6Client::UpdateAddresses(void)
|
||||
|
||||
found = false;
|
||||
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); i++)
|
||||
{
|
||||
if (mIdentityAssociations[i].mStatus == kIaStatusInvalid)
|
||||
{
|
||||
@@ -194,7 +194,7 @@ bool Dhcp6Client::ProcessNextIdentityAssociation()
|
||||
|
||||
mTrickleTimer.Stop();
|
||||
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
{
|
||||
if (mIdentityAssociations[i].mStatus != kIaStatusSolicit)
|
||||
{
|
||||
@@ -341,7 +341,7 @@ otError Dhcp6Client::AppendIaNa(Message &aMessage, uint16_t aRloc16)
|
||||
|
||||
VerifyOrExit(mIdentityAssociationCurrent != NULL, error = OT_ERROR_DROP);
|
||||
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
{
|
||||
if (mIdentityAssociations[i].mStatus == kIaStatusInvalid ||
|
||||
mIdentityAssociations[i].mStatus == kIaStatusSolicitReplied)
|
||||
@@ -378,7 +378,7 @@ otError Dhcp6Client::AppendIaAddress(Message &aMessage, uint16_t aRloc16)
|
||||
|
||||
option.Init();
|
||||
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
{
|
||||
if ((mIdentityAssociations[i].mStatus == kIaStatusSolicit ||
|
||||
mIdentityAssociations[i].mStatus == kIaStatusSoliciting) &&
|
||||
@@ -571,7 +571,7 @@ otError Dhcp6Client::ProcessIaAddress(Message &aMessage, uint16_t aOffset)
|
||||
(option.GetLength() == (sizeof(option) - sizeof(Dhcp6Option)))),
|
||||
error = OT_ERROR_PARSE);
|
||||
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mIdentityAssociations); ++i)
|
||||
{
|
||||
IdentityAssociation &ia = mIdentityAssociations[i];
|
||||
|
||||
|
||||
@@ -64,7 +64,7 @@ otError Dhcp6Server::UpdateService(void)
|
||||
Lowpan::Context lowpanContext;
|
||||
|
||||
// remove dhcp agent aloc and prefix delegation
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
{
|
||||
bool found = false;
|
||||
|
||||
@@ -149,7 +149,7 @@ otError Dhcp6Server::AddPrefixAgent(const otIp6Prefix &aIp6Prefix, const Lowpan:
|
||||
otError error = OT_ERROR_NONE;
|
||||
PrefixAgent *newEntry = NULL;
|
||||
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
{
|
||||
if (!mPrefixAgents[i].IsValid())
|
||||
{
|
||||
@@ -312,7 +312,7 @@ otError Dhcp6Server::ProcessIaAddress(Message &aMessage, uint16_t aOffset)
|
||||
error = OT_ERROR_PARSE);
|
||||
|
||||
// mask matching prefix
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
{
|
||||
if (mPrefixAgents[i].IsValid() && mPrefixAgents[i].IsPrefixMatch(option.GetAddress()))
|
||||
{
|
||||
@@ -394,7 +394,7 @@ otError Dhcp6Server::AppendIaNa(Message &aMessage, IaNa &aIaNa)
|
||||
|
||||
if (mPrefixAgentsMask)
|
||||
{
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
{
|
||||
if ((mPrefixAgentsMask & (1 << i)))
|
||||
{
|
||||
@@ -434,7 +434,7 @@ otError Dhcp6Server::AppendIaAddress(Message &aMessage, ClientIdentifier &aClien
|
||||
if (mPrefixAgentsMask)
|
||||
{
|
||||
// if specified, only apply specified prefixes
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
{
|
||||
if (mPrefixAgentsMask & (1 << i))
|
||||
{
|
||||
@@ -445,7 +445,7 @@ otError Dhcp6Server::AppendIaAddress(Message &aMessage, ClientIdentifier &aClien
|
||||
else
|
||||
{
|
||||
// if not specified, apply all configured prefixes
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
{
|
||||
if (mPrefixAgents[i].IsValid())
|
||||
{
|
||||
@@ -484,7 +484,7 @@ otError Dhcp6Server::AppendRapidCommit(Message &aMessage)
|
||||
|
||||
void Dhcp6Server::ApplyMeshLocalPrefix(void)
|
||||
{
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mPrefixAgents); i++)
|
||||
{
|
||||
if (mPrefixAgents[i].IsValid())
|
||||
{
|
||||
|
||||
@@ -82,7 +82,7 @@ void AddressResolver::Clear(void)
|
||||
{
|
||||
CacheEntryList *lists[] = {&mCachedList, &mSnoopedList, &mQueryList, &mQueryRetryList};
|
||||
|
||||
for (uint8_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
for (size_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
{
|
||||
CacheEntryList *list = lists[index];
|
||||
CacheEntry * entry;
|
||||
@@ -198,7 +198,7 @@ void AddressResolver::Remove(Mac::ShortAddress aRloc16, bool aMatchRouterId)
|
||||
{
|
||||
CacheEntryList *lists[] = {&mCachedList, &mSnoopedList};
|
||||
|
||||
for (uint8_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
for (size_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
{
|
||||
CacheEntryList *list = lists[index];
|
||||
CacheEntry * prev = NULL;
|
||||
@@ -248,7 +248,7 @@ AddressResolver::CacheEntry *AddressResolver::FindCacheEntry(const Ip6::Address
|
||||
CacheEntry * entry = NULL;
|
||||
CacheEntryList *lists[] = {&mCachedList, &mSnoopedList, &mQueryList, &mQueryRetryList};
|
||||
|
||||
for (uint8_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
for (size_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
{
|
||||
aList = lists[index];
|
||||
entry = FindCacheEntryInList(*aList, aEid, aPrevEntry);
|
||||
@@ -300,7 +300,7 @@ AddressResolver::CacheEntry *AddressResolver::NewCacheEntry(bool aSnoopedEntry)
|
||||
newEntry = mUnusedList.Pop();
|
||||
VerifyOrExit(newEntry == NULL, OT_NOOP);
|
||||
|
||||
for (uint8_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
for (size_t index = 0; index < OT_ARRAY_LENGTH(lists); index++)
|
||||
{
|
||||
CacheEntryList *list = lists[index];
|
||||
CacheEntry * prev;
|
||||
|
||||
@@ -967,7 +967,7 @@ void Mle::ApplyMeshLocalPrefix(void)
|
||||
|
||||
#if OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE
|
||||
|
||||
for (uint8_t i = 0; i < OT_ARRAY_LENGTH(mServiceAlocs); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(mServiceAlocs); i++)
|
||||
{
|
||||
if (mServiceAlocs[i].GetAddress().GetLocator() != Mac::kShortAddrInvalid)
|
||||
{
|
||||
@@ -1613,9 +1613,9 @@ void Mle::UpdateServiceAlocs(void)
|
||||
uint16_t rloc = GetRloc16();
|
||||
uint16_t serviceAloc = 0;
|
||||
uint8_t serviceId = 0;
|
||||
int i = 0;
|
||||
NetworkData::Iterator serviceIterator = NetworkData::kIteratorInit;
|
||||
int serviceAlocsLength = OT_ARRAY_LENGTH(mServiceAlocs);
|
||||
size_t serviceAlocsLength = OT_ARRAY_LENGTH(mServiceAlocs);
|
||||
size_t i = 0;
|
||||
|
||||
VerifyOrExit(!IsDisabled(), OT_NOOP);
|
||||
|
||||
|
||||
@@ -3700,7 +3700,7 @@ void NcpBase::ProcessThreadChangedFlags(void)
|
||||
|
||||
// Convert OT_CHANGED flags to corresponding NCP property update.
|
||||
|
||||
for (unsigned i = 0; i < OT_ARRAY_LENGTH(kFlags); i++)
|
||||
for (size_t i = 0; i < OT_ARRAY_LENGTH(kFlags); i++)
|
||||
{
|
||||
uint32_t threadFlag = kFlags[i].mThreadFlag;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user