diff --git a/src/cli/cli.cpp b/src/cli/cli.cpp index 791ce7cd0..7fc1beeb9 100644 --- a/src/cli/cli.cpp +++ b/src/cli/cli.cpp @@ -458,10 +458,10 @@ void Interpreter::ProcessChannel(int argc, char *argv[]) uint32_t channelMask = otLinkGetSupportedChannelMask(mInstance); uint8_t channelNum = sizeof(channelMask) * CHAR_BIT; - mServer->OutputFormat("interval: %lu\r\n", otChannelMonitorGetSampleInterval(mInstance)); + mServer->OutputFormat("interval: %u\r\n", otChannelMonitorGetSampleInterval(mInstance)); mServer->OutputFormat("threshold: %d\r\n", otChannelMonitorGetRssiThreshold(mInstance)); - mServer->OutputFormat("window: %lu\r\n", otChannelMonitorGetSampleWindow(mInstance)); - mServer->OutputFormat("count: %lu\r\n", otChannelMonitorGetSampleCount(mInstance)); + mServer->OutputFormat("window: %u\r\n", otChannelMonitorGetSampleWindow(mInstance)); + mServer->OutputFormat("count: %u\r\n", otChannelMonitorGetSampleCount(mInstance)); mServer->OutputFormat("occupancies:\r\n"); for (uint8_t channel = 0; channel < channelNum; channel++) @@ -1895,7 +1895,8 @@ void Interpreter::HandleIcmpReceive(Message & aMessage, VerifyOrExit(aIcmpHeader.mType == OT_ICMP6_TYPE_ECHO_REPLY); - mServer->OutputFormat("%d bytes from ", aMessage.GetLength() - aMessage.GetOffset() + sizeof(otIcmp6Header)); + mServer->OutputFormat("%u bytes from ", + aMessage.GetLength() - aMessage.GetOffset() + static_cast(sizeof(otIcmp6Header))); OutputIp6Address(aMessageInfo.GetPeerAddr()); @@ -2917,7 +2918,7 @@ void Interpreter::HandleSntpResponse(uint64_t aTime, otError aResult) { // Some Embedded C libraries do not support printing of 64-bit unsigned integers. // To simplify, unix epoch time and era number are printed separately. - mServer->OutputFormat("SNTP response - Unix time: %ld (era: %ld)\r\n", static_cast(aTime), + mServer->OutputFormat("SNTP response - Unix time: %u (era: %u)\r\n", static_cast(aTime), static_cast(aTime >> 32)); } else diff --git a/src/cli/cli_dataset.cpp b/src/cli/cli_dataset.cpp index 1d51cb09e..b31a8274d 100644 --- a/src/cli/cli_dataset.cpp +++ b/src/cli/cli_dataset.cpp @@ -83,12 +83,12 @@ otError Dataset::Print(otOperationalDataset &aDataset) { if (aDataset.mComponents.mIsPendingTimestampPresent) { - mInterpreter.mServer->OutputFormat("Pending Timestamp: %d\r\n", aDataset.mPendingTimestamp); + mInterpreter.mServer->OutputFormat("Pending Timestamp: %lu\r\n", aDataset.mPendingTimestamp); } if (aDataset.mComponents.mIsActiveTimestampPresent) { - mInterpreter.mServer->OutputFormat("Active Timestamp: %d\r\n", aDataset.mActiveTimestamp); + mInterpreter.mServer->OutputFormat("Active Timestamp: %lu\r\n", aDataset.mActiveTimestamp); } if (aDataset.mComponents.mIsChannelPresent) @@ -132,7 +132,8 @@ otError Dataset::Print(otOperationalDataset &aDataset) if (aDataset.mComponents.mIsNetworkNamePresent) { mInterpreter.mServer->OutputFormat("Network Name: "); - mInterpreter.mServer->OutputFormat("%.*s\r\n", sizeof(aDataset.mNetworkName), aDataset.mNetworkName.m8); + mInterpreter.mServer->OutputFormat("%.*s\r\n", static_cast(sizeof(aDataset.mNetworkName)), + aDataset.mNetworkName.m8); } if (aDataset.mComponents.mIsPanIdPresent)