mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-10-15 17:27:46 -04:00
Create a new branch and address 10.8 warnings (#241)
This commit is contained in:
parent
6c86457bb7
commit
889d3e8667
2 changed files with 34 additions and 16 deletions
|
@ -581,7 +581,7 @@ BaseType_t xReady = pdFALSE;
|
||||||
static int32_t prvTCPSendPacket( FreeRTOS_Socket_t *pxSocket )
|
static int32_t prvTCPSendPacket( FreeRTOS_Socket_t *pxSocket )
|
||||||
{
|
{
|
||||||
int32_t lResult = 0;
|
int32_t lResult = 0;
|
||||||
UBaseType_t uxOptionsLength;
|
UBaseType_t uxOptionsLength, uxIntermediateResult = 0;
|
||||||
NetworkBufferDescriptor_t *pxNetworkBuffer;
|
NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||||
|
|
||||||
if( pxSocket->u.xTCP.ucTCPState != ( uint8_t ) eCONNECT_SYN )
|
if( pxSocket->u.xTCP.ucTCPState != ( uint8_t ) eCONNECT_SYN )
|
||||||
|
@ -626,7 +626,8 @@ NetworkBufferDescriptor_t *pxNetworkBuffer;
|
||||||
uxOptionsLength = prvSetSynAckOptions( pxSocket, &( pxProtocolHeaders->xTCPHeader ) );
|
uxOptionsLength = prvSetSynAckOptions( pxSocket, &( pxProtocolHeaders->xTCPHeader ) );
|
||||||
|
|
||||||
/* Return the number of bytes to be sent. */
|
/* Return the number of bytes to be sent. */
|
||||||
lResult = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||||
|
lResult = ( int32_t ) uxIntermediateResult;
|
||||||
|
|
||||||
/* Set the TCP offset field: ipSIZE_OF_TCP_HEADER equals 20 and
|
/* Set the TCP offset field: ipSIZE_OF_TCP_HEADER equals 20 and
|
||||||
uxOptionsLength is always a multiple of 4. The complete expression
|
uxOptionsLength is always a multiple of 4. The complete expression
|
||||||
|
@ -1785,6 +1786,7 @@ uint32_t ulDataGot, ulDistance;
|
||||||
TCPWindow_t *pxTCPWindow;
|
TCPWindow_t *pxTCPWindow;
|
||||||
NetworkBufferDescriptor_t *pxNewBuffer;
|
NetworkBufferDescriptor_t *pxNewBuffer;
|
||||||
int32_t lStreamPos;
|
int32_t lStreamPos;
|
||||||
|
UBaseType_t uxIntermediateResult = 0;
|
||||||
|
|
||||||
if( ( *ppxNetworkBuffer ) != NULL )
|
if( ( *ppxNetworkBuffer ) != NULL )
|
||||||
{
|
{
|
||||||
|
@ -1957,7 +1959,8 @@ int32_t lStreamPos;
|
||||||
pxProtocolHeaders->xTCPHeader.ucTCPFlags |= ( uint8_t ) tcpTCP_FLAG_PSH;
|
pxProtocolHeaders->xTCPHeader.ucTCPFlags |= ( uint8_t ) tcpTCP_FLAG_PSH;
|
||||||
}
|
}
|
||||||
|
|
||||||
lDataLen += ipNUMERIC_CAST( int32_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||||
|
lDataLen += ( int32_t ) uxIntermediateResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
return lDataLen;
|
return lDataLen;
|
||||||
|
@ -2077,7 +2080,7 @@ static BaseType_t prvTCPHandleFin( FreeRTOS_Socket_t *pxSocket, const NetworkBuf
|
||||||
ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t,
|
||||||
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
&( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER + xIPHeaderSize( pxNetworkBuffer ) ] ) );
|
||||||
TCPHeader_t *pxTCPHeader = &( pxProtocolHeaders->xTCPHeader );
|
TCPHeader_t *pxTCPHeader = &( pxProtocolHeaders->xTCPHeader );
|
||||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
uint8_t ucIntermediateResult = 0, ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||||
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||||
BaseType_t xSendLength = 0;
|
BaseType_t xSendLength = 0;
|
||||||
uint32_t ulAckNr = FreeRTOS_ntohl( pxTCPHeader->ulAckNr );
|
uint32_t ulAckNr = FreeRTOS_ntohl( pxTCPHeader->ulAckNr );
|
||||||
|
@ -2143,7 +2146,8 @@ uint32_t ulAckNr = FreeRTOS_ntohl( pxTCPHeader->ulAckNr );
|
||||||
|
|
||||||
if( pxTCPHeader->ucTCPFlags != 0U )
|
if( pxTCPHeader->ucTCPFlags != 0U )
|
||||||
{
|
{
|
||||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + pxTCPWindow->ucOptionLength );
|
ucIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + pxTCPWindow->ucOptionLength;
|
||||||
|
xSendLength = ( BaseType_t ) ucIntermediateResult;
|
||||||
}
|
}
|
||||||
|
|
||||||
pxTCPHeader->ucTCPOffset = ( uint8_t ) ( ( ipSIZE_OF_TCP_HEADER + pxTCPWindow->ucOptionLength ) << 2 );
|
pxTCPHeader->ucTCPOffset = ( uint8_t ) ( ( ipSIZE_OF_TCP_HEADER + pxTCPWindow->ucOptionLength ) << 2 );
|
||||||
|
@ -2180,6 +2184,7 @@ int32_t lLength, lTCPHeaderLength, lReceiveLength, lUrgentLength;
|
||||||
const IPHeader_t *pxIPHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPHeader_t, &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER ] ) );
|
const IPHeader_t *pxIPHeader = ipCAST_CONST_PTR_TO_CONST_TYPE_PTR( IPHeader_t, &( pxNetworkBuffer->pucEthernetBuffer[ ipSIZE_OF_ETH_HEADER ] ) );
|
||||||
const size_t xIPHeaderLength = ipSIZE_OF_IPv4_HEADER;
|
const size_t xIPHeaderLength = ipSIZE_OF_IPv4_HEADER;
|
||||||
uint16_t usLength;
|
uint16_t usLength;
|
||||||
|
uint8_t ucIntermediateResult = 0;
|
||||||
|
|
||||||
/* Determine the length and the offset of the user-data sent to this
|
/* Determine the length and the offset of the user-data sent to this
|
||||||
node.
|
node.
|
||||||
|
@ -2187,7 +2192,8 @@ uint16_t usLength;
|
||||||
The size of the TCP header is given in a multiple of 4-byte words (single
|
The size of the TCP header is given in a multiple of 4-byte words (single
|
||||||
byte, needs no ntoh() translation). A shift-right 2: is the same as
|
byte, needs no ntoh() translation). A shift-right 2: is the same as
|
||||||
(offset >> 4) * 4. */
|
(offset >> 4) * 4. */
|
||||||
lTCPHeaderLength = ipNUMERIC_CAST( BaseType_t, ( pxTCPHeader->ucTCPOffset & tcpVALID_BITS_IN_TCP_OFFSET_BYTE ) >> 2 );
|
ucIntermediateResult = ( pxTCPHeader->ucTCPOffset & tcpVALID_BITS_IN_TCP_OFFSET_BYTE ) >> 2;
|
||||||
|
lTCPHeaderLength = ( int32_t ) ucIntermediateResult;
|
||||||
|
|
||||||
/* Let pucRecvData point to the first byte received. */
|
/* Let pucRecvData point to the first byte received. */
|
||||||
*ppucRecvData = &( pxNetworkBuffer->pucEthernetBuffer[ ( size_t ) ipSIZE_OF_ETH_HEADER + xIPHeaderLength + ( size_t ) lTCPHeaderLength ] );
|
*ppucRecvData = &( pxNetworkBuffer->pucEthernetBuffer[ ( size_t ) ipSIZE_OF_ETH_HEADER + xIPHeaderLength + ( size_t ) lTCPHeaderLength ] );
|
||||||
|
@ -2394,6 +2400,7 @@ TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||||
uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber );
|
uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber );
|
||||||
BaseType_t xSendLength = 0;
|
BaseType_t xSendLength = 0;
|
||||||
|
UBaseType_t uxIntermediateResult = 0;
|
||||||
|
|
||||||
/* Either expect a ACK or a SYN+ACK. */
|
/* Either expect a ACK or a SYN+ACK. */
|
||||||
uint8_t ucExpect = tcpTCP_FLAG_ACK;
|
uint8_t ucExpect = tcpTCP_FLAG_ACK;
|
||||||
|
@ -2418,7 +2425,10 @@ BaseType_t xSendLength = 0;
|
||||||
pxTCPWindow->rx.ulCurrentSequenceNumber = ulSequenceNumber;
|
pxTCPWindow->rx.ulCurrentSequenceNumber = ulSequenceNumber;
|
||||||
|
|
||||||
pxTCPHeader->ucTCPFlags |= tcpTCP_FLAG_RST;
|
pxTCPHeader->ucTCPFlags |= tcpTCP_FLAG_RST;
|
||||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
|
||||||
|
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||||
|
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||||
|
|
||||||
pxTCPHeader->ucTCPOffset = ( uint8_t )( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
pxTCPHeader->ucTCPOffset = ( uint8_t )( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2472,7 +2482,9 @@ BaseType_t xSendLength = 0;
|
||||||
if( ( pxSocket->u.xTCP.ucTCPState == ( EventBits_t ) eCONNECT_SYN ) || ( ulReceiveLength != 0UL ) )
|
if( ( pxSocket->u.xTCP.ucTCPState == ( EventBits_t ) eCONNECT_SYN ) || ( ulReceiveLength != 0UL ) )
|
||||||
{
|
{
|
||||||
pxTCPHeader->ucTCPFlags = tcpTCP_FLAG_ACK;
|
pxTCPHeader->ucTCPFlags = tcpTCP_FLAG_ACK;
|
||||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ( size_t ) ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
|
||||||
|
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ( size_t ) ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||||
|
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||||
pxTCPHeader->ucTCPOffset = ( uint8_t ) ( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
pxTCPHeader->ucTCPOffset = ( uint8_t ) ( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
||||||
}
|
}
|
||||||
#if( ipconfigUSE_TCP_WIN != 0 )
|
#if( ipconfigUSE_TCP_WIN != 0 )
|
||||||
|
@ -2512,10 +2524,11 @@ ProtocolHeaders_t *pxProtocolHeaders = ipCAST_PTR_TO_TYPE_PTR( ProtocolHeaders_t
|
||||||
TCPHeader_t *pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
|
TCPHeader_t *pxTCPHeader = &pxProtocolHeaders->xTCPHeader;
|
||||||
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
TCPWindow_t *pxTCPWindow = &pxSocket->u.xTCP.xTCPWindow;
|
||||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||||
uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber ), ulCount;
|
uint32_t ulSequenceNumber = FreeRTOS_ntohl( pxTCPHeader->ulSequenceNumber ), ulCount, ulIntermediateResult = 0;
|
||||||
BaseType_t xSendLength = 0, xMayClose = pdFALSE, bRxComplete, bTxDone;
|
BaseType_t xSendLength = 0, xMayClose = pdFALSE, bRxComplete, bTxDone;
|
||||||
int32_t lDistance, lSendResult;
|
int32_t lDistance, lSendResult;
|
||||||
uint16_t usWindow;
|
uint16_t usWindow;
|
||||||
|
UBaseType_t uxIntermediateResult = 0;
|
||||||
|
|
||||||
/* Remember the window size the peer is advertising. */
|
/* Remember the window size the peer is advertising. */
|
||||||
usWindow = FreeRTOS_ntohs( pxTCPHeader->usWindow );
|
usWindow = FreeRTOS_ntohs( pxTCPHeader->usWindow );
|
||||||
|
@ -2598,7 +2611,8 @@ uint16_t usWindow;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
lDistance = ipNUMERIC_CAST( int32_t, ulSequenceNumber + ulReceiveLength - pxTCPWindow->rx.ulCurrentSequenceNumber );
|
ulIntermediateResult = ulSequenceNumber + ulReceiveLength - pxTCPWindow->rx.ulCurrentSequenceNumber;
|
||||||
|
lDistance = ( int32_t ) ulIntermediateResult;
|
||||||
|
|
||||||
if( lDistance > 1 )
|
if( lDistance > 1 )
|
||||||
{
|
{
|
||||||
|
@ -2631,7 +2645,8 @@ uint16_t usWindow;
|
||||||
|
|
||||||
if( ulReceiveLength != 0U )
|
if( ulReceiveLength != 0U )
|
||||||
{
|
{
|
||||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||||
|
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||||
/* TCP-offsett equals '( ( length / 4 ) << 4 )', resulting in a shift-left 2 */
|
/* TCP-offsett equals '( ( length / 4 ) << 4 )', resulting in a shift-left 2 */
|
||||||
pxTCPHeader->ucTCPOffset = ( uint8_t )( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
pxTCPHeader->ucTCPOffset = ( uint8_t )( ( ipSIZE_OF_TCP_HEADER + uxOptionsLength ) << 2 );
|
||||||
|
|
||||||
|
@ -2836,6 +2851,7 @@ uint32_t ulSequenceNumber = FreeRTOS_ntohl (pxTCPHeader->ulSequenceNumber);
|
||||||
UBaseType_t uxOptionsLength = 0U;
|
UBaseType_t uxOptionsLength = 0U;
|
||||||
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
uint8_t ucTCPFlags = pxTCPHeader->ucTCPFlags;
|
||||||
TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
|
TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
|
||||||
|
UBaseType_t uxIntermediateResult = 0;
|
||||||
|
|
||||||
/* First get the length and the position of the received data, if any.
|
/* First get the length and the position of the received data, if any.
|
||||||
pucRecvData will point to the first byte of the TCP payload. */
|
pucRecvData will point to the first byte of the TCP payload. */
|
||||||
|
@ -2916,7 +2932,8 @@ TCPWindow_t *pxTCPWindow = &( pxSocket->u.xTCP.xTCPWindow );
|
||||||
uxOptionsLength = prvSetSynAckOptions( pxSocket, pxTCPHeader );
|
uxOptionsLength = prvSetSynAckOptions( pxSocket, pxTCPHeader );
|
||||||
pxTCPHeader->ucTCPFlags = ( uint8_t ) tcpTCP_FLAG_SYN | ( uint8_t ) tcpTCP_FLAG_ACK;
|
pxTCPHeader->ucTCPFlags = ( uint8_t ) tcpTCP_FLAG_SYN | ( uint8_t ) tcpTCP_FLAG_ACK;
|
||||||
|
|
||||||
xSendLength = ipNUMERIC_CAST( BaseType_t, uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength );
|
uxIntermediateResult = uxIPHeaderSizeSocket( pxSocket ) + ipSIZE_OF_TCP_HEADER + uxOptionsLength;
|
||||||
|
xSendLength = ( BaseType_t ) uxIntermediateResult;
|
||||||
|
|
||||||
/* Set the TCP offset field: ipSIZE_OF_TCP_HEADER equals 20 and
|
/* Set the TCP offset field: ipSIZE_OF_TCP_HEADER equals 20 and
|
||||||
uxOptionsLength is a multiple of 4. The complete expression is:
|
uxOptionsLength is a multiple of 4. The complete expression is:
|
||||||
|
|
|
@ -801,7 +801,7 @@ const int32_t l500ms = 500;
|
||||||
|
|
||||||
int32_t lTCPWindowRxCheck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength, uint32_t ulSpace )
|
int32_t lTCPWindowRxCheck( TCPWindow_t *pxWindow, uint32_t ulSequenceNumber, uint32_t ulLength, uint32_t ulSpace )
|
||||||
{
|
{
|
||||||
uint32_t ulCurrentSequenceNumber, ulLast, ulSavedSequenceNumber, ulSequenceNumberDiff;
|
uint32_t ulCurrentSequenceNumber, ulLast, ulSavedSequenceNumber, ulIntermediateResult = 0;
|
||||||
int32_t lReturn, lDistance;
|
int32_t lReturn, lDistance;
|
||||||
TCPSegment_t *pxFound;
|
TCPSegment_t *pxFound;
|
||||||
|
|
||||||
|
@ -910,9 +910,9 @@ const int32_t l500ms = 500;
|
||||||
Prepare a SACK (Selective ACK). */
|
Prepare a SACK (Selective ACK). */
|
||||||
ulLast = ulSequenceNumber + ulLength;
|
ulLast = ulSequenceNumber + ulLength;
|
||||||
|
|
||||||
ulSequenceNumberDiff = ulLast - ulCurrentSequenceNumber;
|
ulIntermediateResult = ulLast - ulCurrentSequenceNumber;
|
||||||
/* The cast from unsigned long to signed long is on purpose. */
|
/* The cast from unsigned long to signed long is on purpose. */
|
||||||
lDistance = ( int32_t ) ulSequenceNumberDiff;
|
lDistance = ( int32_t ) ulIntermediateResult;
|
||||||
|
|
||||||
if( lDistance <= 0 )
|
if( lDistance <= 0 )
|
||||||
{
|
{
|
||||||
|
@ -1006,7 +1006,8 @@ const int32_t l500ms = 500;
|
||||||
|
|
||||||
/* Return a positive value. The packet may be accepted
|
/* Return a positive value. The packet may be accepted
|
||||||
and stored but an earlier packet is still missing. */
|
and stored but an earlier packet is still missing. */
|
||||||
lReturn = ipNUMERIC_CAST( int32_t, ulSequenceNumber - ulCurrentSequenceNumber );
|
ulIntermediateResult = ulSequenceNumber - ulCurrentSequenceNumber;
|
||||||
|
lReturn = ( int32_t ) ulIntermediateResult;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue