Skip to content

Commit b23450c

Browse files
committed
Cast htonl() to unsigned long when printing
ntohl() returns a u32, which is defined as an unsigned int in Clang. So we need to explicitely upper cast it into unsigned long. Fixes this Clang warnining: > /source/FreeRTOS_IPv4.c:443:52: warning: format specifies type 'unsigned long' but the argument has type 'uint32_t' (aka 'unsigned int') [-Wformat] > 442 | FreeRTOS_printf( ( "prvAllowIPPacket: UDP packet from %lxip without CRC dropped\n", > | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > | %x > 443 | FreeRTOS_ntohl( pxIPPacket->xIPHeader.ulSourceIPAddress ) ) ); > | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > /source/include/FreeRTOS_IP.h:252:32: note: expanded from macro 'FreeRTOS_ntohl' > 252 | #define FreeRTOS_ntohl( x ) FreeRTOS_htonl( x ) > | ^ > /source/include/FreeRTOS_IP.h:233:5: note: expanded from macro 'FreeRTOS_htonl' > 233 | ( \ > | ^ > /build/src/FreeRTOSIPConfig.h:75:12: note: expanded from macro 'FreeRTOS_printf' > 75 | printf X > | ^
1 parent b95e645 commit b23450c

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

source/FreeRTOS_IPv4.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -440,7 +440,7 @@ enum eFrameProcessingResult prvAllowIPPacketIPv4( const struct xIP_PACKET * cons
440440
if( xCount < 5 ) /* LCOV_EXCL_BR_LINE */
441441
{
442442
FreeRTOS_printf( ( "prvAllowIPPacket: UDP packet from %lxip without CRC dropped\n",
443-
FreeRTOS_ntohl( pxIPPacket->xIPHeader.ulSourceIPAddress ) ) );
443+
( unsigned long ) FreeRTOS_ntohl( pxIPPacket->xIPHeader.ulSourceIPAddress ) ) );
444444
xCount++;
445445
}
446446
}

0 commit comments

Comments
 (0)