Skip to content

Commit

Permalink
Enable -Wconversion in Tizen platform code. (#25408)
Browse files Browse the repository at this point in the history
  • Loading branch information
bzbarsky-apple authored and pull[bot] committed May 3, 2024
1 parent d220bf9 commit 2150434
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/platform/Tizen/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -106,4 +106,6 @@ static_library("Tizen") {
"WiFiManager.h",
]
}

cflags = [ "-Wconversion" ]
}
3 changes: 2 additions & 1 deletion src/platform/Tizen/NetworkCommissioningEthernetDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,8 @@ bool TizenEthernetDriver::EthernetNetworkIterator::Next(Network & item)
VerifyOrReturnValue(mInterfacesIdx < mInterfaces.size(), false);

const auto & iface = mInterfaces[mInterfacesIdx++];
item.networkIDLen = std::min(iface.size(), kMaxNetworkIDLen);
static_assert(kMaxNetworkIDLen <= UINT8_MAX, "Our length won't fit in networkIDLen");
item.networkIDLen = static_cast<uint8_t>(std::min(iface.size(), kMaxNetworkIDLen));
memcpy(item.networkID, iface.c_str(), item.networkIDLen);
item.connected = true;

Expand Down
7 changes: 5 additions & 2 deletions src/platform/Tizen/NetworkCommissioningWiFiDriver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,11 @@ CHIP_ERROR TizenWiFiDriver::Init(BaseDriver::NetworkStatusChangeCallback * netwo
{
return CHIP_NO_ERROR;
}
mSavedNetwork.credentialsLen = credentialsLen;
mSavedNetwork.ssidLen = ssidLen;
static_assert(sizeof(mSavedNetwork.credentials) <= UINT8_MAX, "credentialsLen might not fit");
mSavedNetwork.credentialsLen = static_cast<uint8_t>(credentialsLen);

static_assert(sizeof(mSavedNetwork.ssid) <= UINT8_MAX, "ssidLen might not fit");
mSavedNetwork.ssidLen = static_cast<uint8_t>(ssidLen);

mStagingNetwork = mSavedNetwork;
return err;
Expand Down

0 comments on commit 2150434

Please sign in to comment.