Skip to content

Commit

Permalink
cpp-check: Fix cpp-check's findings
Browse files Browse the repository at this point in the history
cpp-check aims to provide unique code analysis to
detect bugs, this commit fixes cpp-check findings
which prevents having an undefined behaviour when
executing our code.

Signed-off-by: Ahmed Ismail <[email protected]>
  • Loading branch information
AhmedIsmail02 authored and urutva committed Oct 19, 2023
1 parent 971b814 commit ea7b6fe
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions Middleware/ARM/IoT_VSocket-lib/transport_tls_iot_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ TransportStatus_t Transport_Connect( NetworkContext_t * pNetworkContext,
uint32_t recvTimeoutMs )
{
TransportStatus_t status = TRANSPORT_STATUS_SUCCESS;
int32_t socketStatus = 0;
int32_t socketStatus;
uint8_t ipAddr[ 4 ];
uint32_t ipAddrLen;
TLSHelperParams_t tlsHelperParams = { 0 };
Expand Down Expand Up @@ -257,14 +257,14 @@ static int Send_Cb( void * pvCallerContext,
TransportStatus_t Transport_Disconnect( NetworkContext_t * pNetworkContext )
{
TransportStatus_t status = TRANSPORT_STATUS_SUCCESS;
int32_t socketStatus;

if( pNetworkContext == NULL )
{
status = TRANSPORT_STATUS_INVALID_PARAMETER;
}
else
{
int32_t socketStatus;
do
{
socketStatus = iotSocketClose( pNetworkContext->socket );
Expand Down
2 changes: 1 addition & 1 deletion Projects/aws-iot-example/event-helper/event_helper.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,5 +58,5 @@ bool xIsMqttAgentConnected( void )
{
EventBits_t uxEvents = xEventGroupGetBits( xSystemEvents );

return( ( bool ) ( uxEvents & EVENT_MASK_MQTT_CONNECTED ) );
return( ( uxEvents & EVENT_MASK_MQTT_CONNECTED ) == 0 ? false : true );
}
6 changes: 3 additions & 3 deletions Projects/aws-iot-example/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -64,12 +64,12 @@ extern uint32_t tfm_ns_interface_init( void );
void vAssertCalled( const char * pcFile,
unsigned long ulLine )
{
volatile unsigned long looping = 0;

printf( "ASSERT failed! file %s:%ld, \n", pcFile, ulLine );
printf( "ASSERT failed! file %s:%lu, \n", pcFile, ulLine );

taskENTER_CRITICAL();
{
volatile unsigned long looping = 0;

/* Use the debugger to set ul to a non-zero value in order to step out
* of this function to determine why it was called. */
while( looping == 0LU )
Expand Down
6 changes: 3 additions & 3 deletions Projects/blinky/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ extern uint32_t tfm_ns_interface_init( void );
void vAssertCalled( const char * pcFile,
unsigned long ulLine )
{
volatile unsigned long looping = 0;

printf( "ASSERT failed! file %s:%ld, \r\n", pcFile, ulLine );
printf( "ASSERT failed! file %s:%lu, \r\n", pcFile, ulLine );

taskENTER_CRITICAL();
{
volatile unsigned long looping = 0;

/* Use the debugger to set ul to a non-zero value in order to step out
* of this function to determine why it was called. */
while( looping == 0LU )
Expand Down

0 comments on commit ea7b6fe

Please sign in to comment.