mirror of
https://github.com/espressif/openthread.git
synced 2026-09-12 04:00:10 +00:00
[cli] fix prints when OT_COAP_BLOCK is enabled (#12021)
`cli_coap.cpp` and `cli_coap_secure.cpp` both try to print `uint32_t` values with `%i`, which causes build errors on some systems. This commit uses `%lu` together with `ToUlong` to fix this and make the code more portable. Additionally, `%u` was used to print unsigned values instead of `%i`
This commit is contained in:
@@ -1117,7 +1117,7 @@ otError Coap::BlockwiseReceiveHook(const uint8_t *aBlock,
|
||||
OT_UNUSED_VARIABLE(aMore);
|
||||
OT_UNUSED_VARIABLE(aTotalLength);
|
||||
|
||||
OutputLine("received block: Num %i Len %i", aPosition / aBlockLength, aBlockLength);
|
||||
OutputLine("received block: Num %lu Len %u", ToUlong(aPosition / aBlockLength), aBlockLength);
|
||||
|
||||
for (uint16_t i = 0; i < aBlockLength / 16; i++)
|
||||
{
|
||||
@@ -1144,7 +1144,7 @@ otError Coap::BlockwiseTransmitHook(uint8_t *aBlock, uint32_t aPosition, uint16_
|
||||
// Send a random payload
|
||||
otRandomNonCryptoFillBuffer(aBlock, *aBlockLength);
|
||||
|
||||
OutputLine("send block: Num %i Len %i", blockCount, *aBlockLength);
|
||||
OutputLine("send block: Num %lu Len %u", ToUlong(blockCount), *aBlockLength);
|
||||
|
||||
for (uint16_t i = 0; i < *aBlockLength / 16; i++)
|
||||
{
|
||||
|
||||
@@ -1001,7 +1001,7 @@ otError CoapSecure::BlockwiseReceiveHook(const uint8_t *aBlock,
|
||||
OT_UNUSED_VARIABLE(aMore);
|
||||
OT_UNUSED_VARIABLE(aTotalLength);
|
||||
|
||||
OutputLine("received block: Num %i Len %i", aPosition / aBlockLength, aBlockLength);
|
||||
OutputLine("received block: Num %lu Len %u", ToUlong(aPosition / aBlockLength), aBlockLength);
|
||||
|
||||
for (uint16_t i = 0; i < aBlockLength / 16; i++)
|
||||
{
|
||||
@@ -1028,7 +1028,7 @@ otError CoapSecure::BlockwiseTransmitHook(uint8_t *aBlock, uint32_t aPosition, u
|
||||
// Send a random payload
|
||||
otRandomNonCryptoFillBuffer(aBlock, *aBlockLength);
|
||||
|
||||
OutputLine("send block: Num %i Len %i", blockCount, *aBlockLength);
|
||||
OutputLine("send block: Num %lu Len %u", ToUlong(blockCount), *aBlockLength);
|
||||
|
||||
for (uint16_t i = 0; i < *aBlockLength / 16; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user