Skip to content

Commit a9beafa

Browse files
Fix warnings on disable USETCP_WIN macro (#932)
* Fix warnings on disable USETCP_WIN macro * Uncrustify: triggered by comment. --------- Co-authored-by: GitHub Action <action@github.com>
1 parent c344f32 commit a9beafa

File tree

3 files changed

+30
-25
lines changed

3 files changed

+30
-25
lines changed

source/FreeRTOS_ND.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -479,14 +479,14 @@
479479
void FreeRTOS_PrintNDCache( void )
480480
{
481481
BaseType_t x, xCount = 0;
482+
char pcBuffer[ 40 ];
482483

483484
/* Loop through each entry in the ND cache. */
484485
for( x = 0; x < ipconfigARP_CACHE_ENTRIES; x++ )
485486
{
486487
if( xNDCache[ x ].ucValid != ( uint8_t ) 0U )
487488
{
488489
/* See if the MAC-address also matches, and we're all happy */
489-
char pcBuffer[ 40 ];
490490

491491
FreeRTOS_printf( ( "ND %2d: age %3u - %pip MAC %02x-%02x-%02x-%02x-%02x-%02x endPoint %s\n",
492492
( int ) x,

source/FreeRTOS_TCP_Transmission.c

+4-3
Original file line numberDiff line numberDiff line change
@@ -1170,11 +1170,12 @@
11701170
int32_t lRxSpace;
11711171
BaseType_t xSendLength = xByteCount;
11721172
uint32_t ulRxBufferSpace;
1173-
/* Two steps to please MISRA. */
1174-
size_t uxSize = uxIPHeaderSizePacket( *ppxNetworkBuffer ) + ipSIZE_OF_TCP_HEADER;
1175-
BaseType_t xSizeWithoutData = ( BaseType_t ) uxSize;
11761173

11771174
#if ( ipconfigUSE_TCP_WIN == 1 )
1175+
/* Two steps to please MISRA. */
1176+
size_t uxSize = uxIPHeaderSizePacket( *ppxNetworkBuffer ) + ipSIZE_OF_TCP_HEADER;
1177+
BaseType_t xSizeWithoutData = ( BaseType_t ) uxSize;
1178+
11781179
int32_t lMinLength;
11791180
#endif
11801181

source/FreeRTOS_TCP_WIN.c

+25-21
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,11 @@
9393
#endif /* configUSE_TCP_WIN */
9494
/*-----------------------------------------------------------*/
9595

96-
static void vListInsertGeneric( List_t * const pxList,
97-
ListItem_t * const pxNewListItem,
98-
MiniListItem_t * pxWhere );
96+
#if ( ipconfigUSE_TCP_WIN == 1 )
97+
static void vListInsertGeneric( List_t * const pxList,
98+
ListItem_t * const pxNewListItem,
99+
MiniListItem_t * pxWhere );
100+
#endif
99101

100102
/*
101103
* All TCP sockets share a pool of segment descriptors (TCPSegment_t)
@@ -383,28 +385,30 @@
383385
* @param[in] pxNewListItem The item to be inserted.
384386
* @param[in] pxWhere Where should the item be inserted.
385387
*/
386-
static void vListInsertGeneric( List_t * const pxList,
387-
ListItem_t * const pxNewListItem,
388-
MiniListItem_t * pxWhere )
389-
{
390-
/* Insert a new list item into pxList, it does not sort the list,
391-
* but it puts the item just before xListEnd, so it will be the last item
392-
* returned by listGET_HEAD_ENTRY() */
388+
#if ( ipconfigUSE_TCP_WIN == 1 )
389+
static void vListInsertGeneric( List_t * const pxList,
390+
ListItem_t * const pxNewListItem,
391+
MiniListItem_t * pxWhere )
392+
{
393+
/* Insert a new list item into pxList, it does not sort the list,
394+
* but it puts the item just before xListEnd, so it will be the last item
395+
* returned by listGET_HEAD_ENTRY() */
393396

394-
/* MISRA Ref 11.3.1 [Misaligned access] */
395-
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
396-
/* coverity[misra_c_2012_rule_11_3_violation] */
397-
pxNewListItem->pxNext = ( ( ListItem_t * ) pxWhere );
397+
/* MISRA Ref 11.3.1 [Misaligned access] */
398+
/* More details at: https://github.com/FreeRTOS/FreeRTOS-Plus-TCP/blob/main/MISRA.md#rule-113 */
399+
/* coverity[misra_c_2012_rule_11_3_violation] */
400+
pxNewListItem->pxNext = ( ( ListItem_t * ) pxWhere );
398401

399-
pxNewListItem->pxPrevious = pxWhere->pxPrevious;
400-
pxWhere->pxPrevious->pxNext = pxNewListItem;
401-
pxWhere->pxPrevious = pxNewListItem;
402+
pxNewListItem->pxPrevious = pxWhere->pxPrevious;
403+
pxWhere->pxPrevious->pxNext = pxNewListItem;
404+
pxWhere->pxPrevious = pxNewListItem;
402405

403-
/* Remember which list the item is in. */
404-
listLIST_ITEM_CONTAINER( pxNewListItem ) = ( struct xLIST * configLIST_VOLATILE ) pxList;
406+
/* Remember which list the item is in. */
407+
listLIST_ITEM_CONTAINER( pxNewListItem ) = ( struct xLIST * configLIST_VOLATILE ) pxList;
405408

406-
( pxList->uxNumberOfItems )++;
407-
}
409+
( pxList->uxNumberOfItems )++;
410+
}
411+
#endif /* if ( ipconfigUSE_TCP_WIN == 1 ) */
408412
/*-----------------------------------------------------------*/
409413

410414
#if ( ipconfigUSE_TCP_WIN == 1 )

0 commit comments

Comments
 (0)