Address various MISRA warnings v3 (#240)

* Add a branch and make MISRA changes

* initialize the value

* Update after Gary's comments
pull/224/head^2
Aniruddha Kanhere 4 years ago committed by GitHub
parent cacf4ad7f9
commit 05b4d4fc64
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -301,7 +301,7 @@ FreeRTOS_Socket_t const *pxSocket = NULL;
Socket_t FreeRTOS_socket( BaseType_t xDomain, BaseType_t xType, BaseType_t xProtocol )
{
FreeRTOS_Socket_t *pxSocket;
size_t uxSocketSize;
size_t uxSocketSize = 0;
EventGroupHandle_t xEventGroup;
Socket_t xReturn;
@ -311,8 +311,8 @@ Socket_t xReturn;
}
else
{
/* Allocate the structure that will hold the socket information. The
size depends on the type of socket: UDP sockets need less space. A
/* Allocate the structure that will hold the socket information. The
size depends on the type of socket: UDP sockets need less space. A
define 'pvPortMallocSocket' will used to allocate the necessary space.
By default it points to the FreeRTOS function 'pvPortMalloc()'. */
pxSocket = ipCAST_PTR_TO_TYPE_PTR( FreeRTOS_Socket_t, pvPortMallocSocket( uxSocketSize ) );
@ -667,6 +667,7 @@ BaseType_t xTimed = pdFALSE;
TimeOut_t xTimeOut;
int32_t lReturn;
EventBits_t xEventBits = ( EventBits_t ) 0;
size_t uxPayloadLength;
if( prvValidSocket( pxSocket, FREERTOS_IPPROTO_UDP, pdTRUE ) == pdFALSE )
{
@ -770,7 +771,8 @@ EventBits_t xEventBits = ( EventBits_t ) 0;
calculated at the total packet size minus the headers.
The validity of `xDataLength` prvProcessIPPacket has been confirmed
in 'prvProcessIPPacket()'. */
lReturn = ( int32_t ) ( pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t ) );
uxPayloadLength = pxNetworkBuffer->xDataLength - sizeof( UDPPacket_t );
lReturn = ( int32_t ) uxPayloadLength;
if( pxSourceAddress != NULL )
{

@ -2678,6 +2678,8 @@ const TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
/* Find out what window size we may advertised. */
int32_t lRxSpace;
BaseType_t xSendLength = xByteCount;
uint32_t ulRxBufferSpace;
#if( ipconfigUSE_TCP_WIN == 1 )
#if( ipconfigTCP_ACK_EARLIER_PACKET == 0 )
const int32_t lMinLength = 0;
@ -2688,7 +2690,9 @@ BaseType_t xSendLength = xByteCount;
/* Set the time-out field, so that we'll be called by the IP-task in case no
next message will be received. */
lRxSpace = ipNUMERIC_CAST( int32_t, pxSocket->u.xTCP.ulHighestRxAllowed - pxTCPWindow->rx.ulCurrentSequenceNumber );
ulRxBufferSpace = pxSocket->u.xTCP.ulHighestRxAllowed - pxTCPWindow->rx.ulCurrentSequenceNumber;
lRxSpace = ( int32_t ) ulRxBufferSpace;
#if ipconfigUSE_TCP_WIN == 1
{

@ -801,7 +801,7 @@ const int32_t l500ms = 500;
int32_t lTCPWindowRxCheck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength, uint32_t ulSpace )
{
uint32_t ulCurrentSequenceNumber, ulLast, ulSavedSequenceNumber;
uint32_t ulCurrentSequenceNumber, ulLast, ulSavedSequenceNumber, ulSequenceNumberDiff;
int32_t lReturn, lDistance;
TCPSegment_t *pxFound;
@ -909,9 +909,10 @@ const int32_t l500ms = 500;
/* An "out-of-sequence" segment was received, must have missed one.
Prepare a SACK (Selective ACK). */
ulLast = ulSequenceNumber + ulLength;
/* The cast from unsigned long to signed long is on purpose.
The macro 'ipNUMERIC_CAST' will prevent PC-lint from complaining. */
lDistance = ipNUMERIC_CAST( int32_t, ulLast - ulCurrentSequenceNumber );
ulSequenceNumberDiff = ulLast - ulCurrentSequenceNumber;
/* The cast from unsigned long to signed long is on purpose. */
lDistance = ( int32_t ) ulSequenceNumberDiff;
if( lDistance <= 0 )
{

Loading…
Cancel
Save