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

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