Address various MISRA warnings v3 (#240)

* Add a branch and make MISRA changes

* initialize the value

* Update after Gary's comments
This commit is contained in:
Aniruddha Kanhere 2020-09-03 15:20:45 -07:00 committed by GitHub
parent cacf4ad7f9
commit 05b4d4fc64
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 9 deletions

View file

@ -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 )
{