clean up warnings from "gcc -Wconversion" (#1344)

* clean up warnings from "gcc -Wconversion"

clean up warnings from "gcc -Wconversion"

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>

* Fix formatting

---------

Signed-off-by: Florian La Roche <Florian.LaRoche@gmail.com>
Co-authored-by: Rahul Kar <karahulx@amazon.com>
This commit is contained in:
Florian La Roche 2025-04-29 17:54:39 +02:00 committed by GitHub
parent 0d2a5ae534
commit 1ca9fd442f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 13 additions and 11 deletions

View file

@ -216,7 +216,7 @@
/* Send the string to the socket. */ /* Send the string to the socket. */
lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */ lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */
( void * ) pcTransmittedString, /* The data being sent. */ ( void * ) pcTransmittedString, /* The data being sent. */
lStringLength, /* The length of the data being sent. */ ( size_t ) lStringLength, /* The length of the data being sent. */
0 ); /* No flags. */ 0 ); /* No flags. */
printf( "FreeRTOS_send returned...transmitted %ld\n", printf( "FreeRTOS_send returned...transmitted %ld\n",
lTransmitted ); lTransmitted );
@ -237,10 +237,10 @@
/* Receive data echoed back to the socket. */ /* Receive data echoed back to the socket. */
while( xReceivedBytes < lTransmitted ) while( xReceivedBytes < lTransmitted )
{ {
xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */ xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
&( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */ &( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */
lStringLength - xReceivedBytes, /* The size of the buffer provided to receive the data. */ ( size_t ) ( lStringLength - xReceivedBytes ), /* The size of the buffer provided to receive the data. */
0 ); /* No flags. */ 0 ); /* No flags. */
if( xReturned < 0 ) if( xReturned < 0 )
{ {
@ -267,9 +267,9 @@
if( xReceivedBytes > 0 ) if( xReceivedBytes > 0 )
{ {
/* Compare the transmitted string to the received string. */ /* Compare the transmitted string to the received string. */
configASSERT( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 ); configASSERT( strncmp( pcReceivedString, pcTransmittedString, ( size_t ) lTransmitted ) == 0 );
if( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 ) if( strncmp( pcReceivedString, pcTransmittedString, ( size_t ) lTransmitted ) == 0 )
{ {
/* The echo reply was received without error. */ /* The echo reply was received without error. */
ulTxRxCycles[ xInstance ]++; ulTxRxCycles[ xInstance ]++;
@ -343,7 +343,7 @@
do do
{ {
( void ) xApplicationGetRandomNumber( &ulRandomNumber ); ( void ) xApplicationGetRandomNumber( &ulRandomNumber );
lCharactersToAdd = ulRandomNumber % ( ulBufferLength - 20UL ); lCharactersToAdd = ( BaseType_t ) ( ulRandomNumber % ( ulBufferLength - 20UL ) );
} while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */ } while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */
/* Fill the buffer. */ /* Fill the buffer. */

View file

@ -285,7 +285,8 @@ static UBaseType_t uxRand( void )
/* Utility function to generate a pseudo random number. */ /* Utility function to generate a pseudo random number. */
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement; ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
return ( ulNextRand >> 16UL ) & 0x7fffUL;
} }
/*-----------------------------------------------------------*/ /*-----------------------------------------------------------*/

View file

@ -182,7 +182,8 @@ static void prvReceivingTask( void * pvParameters )
void vBasicStreamBufferSendFromISR( void ) void vBasicStreamBufferSendFromISR( void )
{ {
static size_t xNextByteToSend = 0; static size_t xNextByteToSend = 0;
const BaseType_t xCallsBetweenSends = 100, xBytesToSend = 4; const size_t xBytesToSend = 4;
const BaseType_t xCallsBetweenSends = 100;
static BaseType_t xCallCount = 0; static BaseType_t xCallCount = 0;
/* Is it time to write to the stream buffer again? */ /* Is it time to write to the stream buffer again? */

View file

@ -783,7 +783,7 @@ static void prvSuspendedTaskTimerTestCallback( TimerHandle_t xExpiredTimer )
static void prvNotifyingTimerCallback( TimerHandle_t xNotUsed ) static void prvNotifyingTimerCallback( TimerHandle_t xNotUsed )
{ {
static BaseType_t uxIndexToNotify = 0; static UBaseType_t uxIndexToNotify = 0;
( void ) xNotUsed; ( void ) xNotUsed;