Skip to content

Commit b81e0ae

Browse files
authored
Fixing MISRA violation 4.6, 10.4 (#527)
* Fixing MISRA violation 4.6, 10.4 * Remove snprintf cast
1 parent 863531d commit b81e0ae

File tree

3 files changed

+7
-7
lines changed

3 files changed

+7
-7
lines changed

source/FreeRTOS_IP_Utils.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1151,7 +1151,7 @@ const char * FreeRTOS_strerror_r( BaseType_t xErrnum,
11511151
/* MISRA Ref 21.6.1 [snprintf and logging] */
11521152
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-216 */
11531153
/* coverity[misra_c_2012_rule_21_6_violation] */
1154-
( void ) snprintf( pcBuffer, uxLength, "Errno %d", ( int ) xErrnum );
1154+
( void ) snprintf( pcBuffer, uxLength, "Errno %d", xErrnum );
11551155
pcName = NULL;
11561156
break;
11571157
}

source/FreeRTOS_TCP_State_Handling.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -371,7 +371,7 @@
371371
uint8_t ucExpect = tcpTCP_FLAG_ACK;
372372
const uint8_t ucFlagsMask = tcpTCP_FLAG_ACK | tcpTCP_FLAG_RST | tcpTCP_FLAG_SYN | tcpTCP_FLAG_FIN;
373373

374-
if( pxSocket->u.xTCP.eTCPState == ( uint8_t ) eCONNECT_SYN )
374+
if( pxSocket->u.xTCP.eTCPState == eCONNECT_SYN )
375375
{
376376
ucExpect |= tcpTCP_FLAG_SYN;
377377
}
@@ -405,7 +405,7 @@
405405
pxTCPWindow->usPeerPortNumber = pxSocket->u.xTCP.usRemotePort;
406406
pxTCPWindow->usOurPortNumber = pxSocket->usLocalPort;
407407

408-
if( pxSocket->u.xTCP.eTCPState == ( uint8_t ) eCONNECT_SYN )
408+
if( pxSocket->u.xTCP.eTCPState == eCONNECT_SYN )
409409
{
410410
/* Map the Last packet onto the ProtocolHeader_t struct for easy access to the fields. */
411411

@@ -452,7 +452,7 @@
452452
}
453453
#endif /* ipconfigUSE_TCP_WIN */
454454

455-
if( ( pxSocket->u.xTCP.eTCPState == ( EventBits_t ) eCONNECT_SYN ) || ( ulReceiveLength != 0U ) )
455+
if( ( pxSocket->u.xTCP.eTCPState == eCONNECT_SYN ) || ( ulReceiveLength != 0U ) )
456456
{
457457
pxTCPHeader->ucTCPFlags = tcpTCP_FLAG_ACK;
458458

@@ -735,7 +735,7 @@
735735
* pucRecvData will point to the first byte of the TCP payload. */
736736
ulReceiveLength = ( uint32_t ) prvCheckRxData( *ppxNetworkBuffer, &pucRecvData );
737737

738-
if( pxSocket->u.xTCP.eTCPState >= ( uint8_t ) eESTABLISHED )
738+
if( pxSocket->u.xTCP.eTCPState >= eESTABLISHED )
739739
{
740740
if( pxTCPWindow->rx.ulCurrentSequenceNumber == ( ulSequenceNumber + 1U ) )
741741
{

test/Coverity/ConfigFiles/FreeRTOSConfig.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@
4545
#define configUSE_IDLE_HOOK 1
4646
#define configUSE_TICK_HOOK 1
4747
#define configUSE_DAEMON_TASK_STARTUP_HOOK 1
48-
#define configTICK_RATE_HZ ( 1000U ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
49-
#define configMINIMAL_STACK_SIZE ( 70 ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
48+
#define configTICK_RATE_HZ ( 1000U ) /* In this non-real time simulated environment the tick frequency has to be at least a multiple of the Win32 tick frequency, and therefore very slow. */
49+
#define configMINIMAL_STACK_SIZE ( ( configSTACK_DEPTH_TYPE ) 70U ) /* In this simulated case, the stack only has to hold one small structure as the real stack is part of the win32 thread. */
5050
#define configTOTAL_HEAP_SIZE ( ( size_t ) ( 52 * 1024 ) )
5151
#define configMAX_TASK_NAME_LEN ( 12 )
5252
#define configUSE_TRACE_FACILITY 1

0 commit comments

Comments
 (0)