Skip to content

Commit 2130bf2

Browse files
bzbarsky-applepull[bot]
authored andcommitted
Enable -Wconversion in openiotsdk platform code. (#25410)
1 parent f432577 commit 2130bf2

File tree

4 files changed

+6
-4
lines changed

4 files changed

+6
-4
lines changed

src/platform/openiotsdk/BUILD.gn

+2
Original file line numberDiff line numberDiff line change
@@ -95,4 +95,6 @@ static_library("openiotsdk") {
9595
"KVBlockDeviceStore.h",
9696
]
9797
}
98+
99+
cflags = [ "-Wconversion" ]
98100
}

src/platform/openiotsdk/KVBlockDeviceStore.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ KVBlockDeviceStoreKeyBuilder::KVBlockDeviceStoreKeyBuilder(const char * key)
457457
if (illegal_ptr)
458458
{
459459
*out++ = '!';
460-
*out++ = 'A' + (int) (illegal_ptr - illegalCharacters);
460+
*out++ = static_cast<char>('A' + (int) (illegal_ptr - illegalCharacters));
461461
}
462462
else
463463
{

src/platform/openiotsdk/KVPsaPsStore.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -601,7 +601,7 @@ void KVPsaPsStoreKeyBuilder::AddKey()
601601
return;
602602
}
603603

604-
uint32_t keyIndex = CONVERT_KEY_TO_INDEX(keyValue);
604+
auto keyIndex = CONVERT_KEY_TO_INDEX(keyValue);
605605
memset(mKvsStoredKeyString[keyIndex], 0, sizeof(mKvsStoredKeyString[keyIndex]));
606606
Platform::CopyString(mKvsStoredKeyString[keyIndex], buffer);
607607
KVPsaPsStore::ScheduleKVSKeyMapUpdate();
@@ -614,7 +614,7 @@ void KVPsaPsStoreKeyBuilder::RemoveKey()
614614
return;
615615
}
616616

617-
uint32_t keyIndex = CONVERT_KEY_TO_INDEX(keyValue);
617+
auto keyIndex = CONVERT_KEY_TO_INDEX(keyValue);
618618
memset(mKvsStoredKeyString[keyIndex], 0, sizeof(mKvsStoredKeyString[keyIndex]));
619619
KVPsaPsStore::ScheduleKVSKeyMapUpdate();
620620
}

src/platform/openiotsdk/NetworkCommissioningEthernetDriver.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ NetworkIterator * OpenIoTSDKEthernetDriver::GetNetworks()
4141
char buf[NETIF_NAMESIZE];
4242
char * ifname = netif_index_to_name(0, buf);
4343

44-
ret->interfaceNameLen = strlen(ifname);
44+
ret->interfaceNameLen = static_cast<uint8_t>(strlen(ifname));
4545
memcpy(ret->interfaceName, ifname, ret->interfaceNameLen);
4646

4747
return ret;

0 commit comments

Comments
 (0)