[clang-tidy] fix bugprone-too-small-loop-variable warnings (#9321)

This commit is contained in:
Jonathan Hui
2023-08-01 16:52:34 -07:00
committed by GitHub
parent 94822eadb5
commit 7d6740c9b5
14 changed files with 20 additions and 19 deletions
+3 -3
View File
@@ -132,7 +132,7 @@ void test_packed_alignment(void)
packedStruct.mByte = 0xfe;
packedStruct.mUint16 = 0xabcd;
for (uint16_t start = 0; start < sizeof(PackedStruct); start++)
for (size_t start = 0; start < sizeof(PackedStruct); start++)
{
uint8_t *ptr = &buffer[start];
@@ -140,14 +140,14 @@ void test_packed_alignment(void)
*reinterpret_cast<PackedStruct *>(ptr) = packedStruct;
for (uint16_t i = 0; i < start; i++)
for (size_t i = 0; i < start; i++)
{
VerifyOrQuit(buffer[i] == 0, "OT_TOOL_PACKED alignment failed - pre-size write");
}
VerifyOrQuit(memcmp(ptr, packedStructBytes, sizeof(PackedStruct)) == 0, "OT_TOOL_PACKED alignment failed");
for (uint16_t i = start + sizeof(packedStruct); i < sizeof(buffer); i++)
for (size_t i = start + sizeof(packedStruct); i < sizeof(buffer); i++)
{
VerifyOrQuit(buffer[i] == 0, "OT_TOOL_PACKED alignment failed - post-size write");
}