Skip to content

Commit 1ca9fd4

Browse files
clean up warnings from "gcc -Wconversion" (FreeRTOS#1344)
* clean up warnings from "gcc -Wconversion" clean up warnings from "gcc -Wconversion" Signed-off-by: Florian La Roche <[email protected]> * Fix formatting --------- Signed-off-by: Florian La Roche <[email protected]> Co-authored-by: Rahul Kar <[email protected]>
1 parent 0d2a5ae commit 1ca9fd4

File tree

4 files changed

+13
-11
lines changed

4 files changed

+13
-11
lines changed

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/TCPEchoClient_SingleTasks.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@
216216
/* Send the string to the socket. */
217217
lTransmitted = FreeRTOS_send( xSocket, /* The socket being sent to. */
218218
( void * ) pcTransmittedString, /* The data being sent. */
219-
lStringLength, /* The length of the data being sent. */
219+
( size_t ) lStringLength, /* The length of the data being sent. */
220220
0 ); /* No flags. */
221221
printf( "FreeRTOS_send returned...transmitted %ld\n",
222222
lTransmitted );
@@ -237,10 +237,10 @@
237237
/* Receive data echoed back to the socket. */
238238
while( xReceivedBytes < lTransmitted )
239239
{
240-
xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
241-
&( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */
242-
lStringLength - xReceivedBytes, /* The size of the buffer provided to receive the data. */
243-
0 ); /* No flags. */
240+
xReturned = FreeRTOS_recv( xSocket, /* The socket being received from. */
241+
&( pcReceivedString[ xReceivedBytes ] ), /* The buffer into which the received data will be written. */
242+
( size_t ) ( lStringLength - xReceivedBytes ), /* The size of the buffer provided to receive the data. */
243+
0 ); /* No flags. */
244244

245245
if( xReturned < 0 )
246246
{
@@ -267,9 +267,9 @@
267267
if( xReceivedBytes > 0 )
268268
{
269269
/* Compare the transmitted string to the received string. */
270-
configASSERT( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 );
270+
configASSERT( strncmp( pcReceivedString, pcTransmittedString, ( size_t ) lTransmitted ) == 0 );
271271

272-
if( strncmp( pcReceivedString, pcTransmittedString, lTransmitted ) == 0 )
272+
if( strncmp( pcReceivedString, pcTransmittedString, ( size_t ) lTransmitted ) == 0 )
273273
{
274274
/* The echo reply was received without error. */
275275
ulTxRxCycles[ xInstance ]++;
@@ -343,7 +343,7 @@
343343
do
344344
{
345345
( void ) xApplicationGetRandomNumber( &ulRandomNumber );
346-
lCharactersToAdd = ulRandomNumber % ( ulBufferLength - 20UL );
346+
lCharactersToAdd = ( BaseType_t ) ( ulRandomNumber % ( ulBufferLength - 20UL ) );
347347
} while( ( lCharactersToAdd == 0 ) || ( lCharactersToAdd < lMinimumLength ) ); /* Must be at least enough to add the unique text to the start of the string later. */
348348

349349
/* Fill the buffer. */

FreeRTOS-Plus/Demo/FreeRTOS_Plus_TCP_Echo_Qemu_mps2/main_networking.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,8 @@ static UBaseType_t uxRand( void )
285285
/* Utility function to generate a pseudo random number. */
286286

287287
ulNextRand = ( ulMultiplier * ulNextRand ) + ulIncrement;
288-
return( ( int ) ( ulNextRand >> 16UL ) & 0x7fffUL );
288+
289+
return ( ulNextRand >> 16UL ) & 0x7fffUL;
289290
}
290291
/*-----------------------------------------------------------*/
291292

FreeRTOS/Demo/Common/Minimal/StreamBufferInterrupt.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,8 @@ static void prvReceivingTask( void * pvParameters )
182182
void vBasicStreamBufferSendFromISR( void )
183183
{
184184
static size_t xNextByteToSend = 0;
185-
const BaseType_t xCallsBetweenSends = 100, xBytesToSend = 4;
185+
const size_t xBytesToSend = 4;
186+
const BaseType_t xCallsBetweenSends = 100;
186187
static BaseType_t xCallCount = 0;
187188

188189
/* Is it time to write to the stream buffer again? */

FreeRTOS/Demo/Common/Minimal/TaskNotifyArray.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -783,7 +783,7 @@ static void prvSuspendedTaskTimerTestCallback( TimerHandle_t xExpiredTimer )
783783

784784
static void prvNotifyingTimerCallback( TimerHandle_t xNotUsed )
785785
{
786-
static BaseType_t uxIndexToNotify = 0;
786+
static UBaseType_t uxIndexToNotify = 0;
787787

788788
( void ) xNotUsed;
789789

0 commit comments

Comments
 (0)