1
0
mirror of https://github.com/FreeRTOS/FreeRTOS-Plus-TCP synced 2025-10-20 13:23:44 +08:00

Misra check fix and update (#476)

* Misra check fix and update
This commit is contained in:
xuelix
2022-06-06 17:47:09 -07:00
committed by GitHub
parent ab3d0fa100
commit 4fb9674de0
25 changed files with 231 additions and 222 deletions

View File

@@ -53,6 +53,7 @@
#include "NetworkBufferManagement.h"
#include "FreeRTOS_ARP.h"
#include "FreeRTOS_TCP_Transmission.h"
#include "FreeRTOS_TCP_Reception.h"
/* Just make sure the contents doesn't get compiled if TCP is not enabled. */
#if ipconfigUSE_TCP == 1
@@ -73,16 +74,11 @@
* Skip past TCP header options when doing Selective ACK, until there are no
* more options left.
*/
_static void prvReadSackOption( const uint8_t * const pucPtr,
size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket );
static void prvReadSackOption( const uint8_t * const pucPtr,
size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket );
#endif /* ( ipconfigUSE_TCP_WIN == 1 ) */
/*
* Reply to a peer with the RST flag on, in case a packet can not be handled.
*/
BaseType_t prvTCPSendReset( NetworkBufferDescriptor_t * pxNetworkBuffer );
/**
* @brief Parse the TCP option(s) received, if present.
*
@@ -369,9 +365,9 @@
* @param[in] uxIndex: Index of options in the TCP packet options.
* @param[in] pxSocket: Socket handling the TCP connection.
*/
_static void prvReadSackOption( const uint8_t * const pucPtr,
size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket )
static void prvReadSackOption( const uint8_t * const pucPtr,
size_t uxIndex,
FreeRTOS_Socket_t * const pxSocket )
{
uint32_t ulFirst = ulChar2u32( &( pucPtr[ uxIndex ] ) );
uint32_t ulLast = ulChar2u32( &( pucPtr[ uxIndex + 4U ] ) );
@@ -521,10 +517,12 @@
uint32_t ulSequenceNumber, ulSpace;
int32_t lOffset, lStored;
BaseType_t xResult = 0;
uint32_t ulRxLength = ulReceiveLength;
uint8_t * pucRxBuffer = &( pucRecvData[ 0 ] );
ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber );
if( ( ulReceiveLength > 0U ) && ( pxSocket->u.xTCP.ucTCPState >= ( uint8_t ) eSYN_RECEIVED ) )
if( ( ulRxLength > 0U ) && ( pxSocket->u.xTCP.ucTCPState >= ( uint8_t ) eSYN_RECEIVED ) )
{
uint32_t ulSkipCount = 0;
@@ -544,7 +542,7 @@
ulSpace = ( uint32_t ) pxSocket->u.xTCP.uxRxStreamSize;
}
lOffset = lTCPWindowRxCheck( pxTCPWindow, ulSequenceNumber, ulReceiveLength, ulSpace, &( ulSkipCount ) );
lOffset = lTCPWindowRxCheck( pxTCPWindow, ulSequenceNumber, ulRxLength, ulSpace, &( ulSkipCount ) );
if( lOffset >= 0 )
{
@@ -557,15 +555,15 @@
/* A packet was received that starts before 'ulCurrentSequenceNumber',
* and that ends after it. The first 'ulSkipCount' bytes shall be
* skipped. */
ulReceiveLength -= ulSkipCount;
pucRecvData = &( pucRecvData[ ulSkipCount ] );
ulRxLength -= ulSkipCount;
pucRxBuffer = &( pucRecvData[ ulSkipCount ] );
}
lStored = lTCPAddRxdata( pxSocket, ( uint32_t ) lOffset, pucRecvData, ulReceiveLength );
lStored = lTCPAddRxdata( pxSocket, ( uint32_t ) lOffset, pucRxBuffer, ulRxLength );
if( lStored != ( int32_t ) ulReceiveLength )
if( lStored != ( int32_t ) ulRxLength )
{
FreeRTOS_debug_printf( ( "lTCPAddRxdata: stored %d / %u bytes? ?\n", ( int ) lStored, ( unsigned ) ulReceiveLength ) );
FreeRTOS_debug_printf( ( "lTCPAddRxdata: stored %d / %u bytes? ?\n", ( int ) lStored, ( unsigned ) ulRxLength ) );
/* Received data could not be stored. The socket's flag
* bMallocError has been set. The socket now has the status