Skip to content

Commit b58ecee

Browse files
SPRESENSExiaoxiang781216
authored andcommitted
apps/examples/udp: Fix warnings by -Wformat
Fix warnings where address of IPv4 is displayed.
1 parent fa589ae commit b58ecee

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

examples/udp/udp_server.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -168,10 +168,10 @@ void udp_server(void)
168168
ntohs(client.sin6_port));
169169
#else
170170
tmpaddr = ntohl(client.sin_addr.s_addr);
171-
printf("server: %d. Received %d bytes from %d.%d.%d.%d:%d\n",
171+
printf("server: %d. Received %d bytes from %u.%u.%u.%u:%d\n",
172172
offset, nbytes,
173-
tmpaddr >> 24, (tmpaddr >> 16) & 0xff,
174-
(tmpaddr >> 8) & 0xff, tmpaddr & 0xff,
173+
(uint8_t)(tmpaddr >> 24), (uint8_t)((tmpaddr >> 16) & 0xff),
174+
(uint8_t)((tmpaddr >> 8) & 0xff), (uint8_t)(tmpaddr & 0xff),
175175
ntohs(client.sin_port));
176176
#endif
177177
if (nbytes < 0)

0 commit comments

Comments
 (0)