From bcd5dec6c46392c8ab30a091dda65379d46a2fb5 Mon Sep 17 00:00:00 2001 From: Gary Wicker <14828980+gkwicker@users.noreply.github.com> Date: Fri, 28 Aug 2020 16:24:25 -0700 Subject: [PATCH] Use unsigned types/constants where needed. (#226) Co-authored-by: Aniruddha Kanhere <60444055+AniruddhaKanhere@users.noreply.github.com> --- .../portable/BufferManagement/BufferAllocation_1.c | 5 +++-- .../portable/BufferManagement/BufferAllocation_2.c | 7 ++++--- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_1.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_1.c index cf0fa11054..4da626c95a 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_1.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_1.c @@ -161,7 +161,8 @@ section macros. */ BaseType_t xNetworkBuffersInitialise( void ) { -BaseType_t xReturn, x; +BaseType_t xReturn; +uint32_t x; /* Only initialise the buffers and their associated kernel objects if they have not been initialised before. */ @@ -182,7 +183,7 @@ BaseType_t xReturn, x; from the network interface, and different hardware has different requirements. */ vNetworkInterfaceAllocateRAMToBuffers( xNetworkBuffers ); - for( x = 0; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ ) + for( x = 0U; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ ) { /* Initialise and set the owner of the buffer list items. */ vListInitialiseItem( &( xNetworkBuffers[ x ].xBufferListItem ) ); diff --git a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_2.c b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_2.c index d8d95e64f4..896ca731e2 100644 --- a/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_2.c +++ b/FreeRTOS-Plus/Source/FreeRTOS-Plus-TCP/portable/BufferManagement/BufferAllocation_2.c @@ -95,7 +95,8 @@ static SemaphoreHandle_t xNetworkBufferSemaphore = NULL; BaseType_t xNetworkBuffersInitialise( void ) { -BaseType_t xReturn, x; +BaseType_t xReturn; +uint32_t x; /* Only initialise the buffers and their associated kernel objects if they have not been initialised before. */ @@ -126,7 +127,7 @@ BaseType_t xReturn, x; /* Initialise all the network buffers. No storage is allocated to the buffers yet. */ - for( x = 0; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ ) + for( x = 0U; x < ipconfigNUM_NETWORK_BUFFER_DESCRIPTORS; x++ ) { /* Initialise and set the owner of the buffer list items. */ xNetworkBufferDescriptors[ x ].pucEthernetBuffer = NULL; @@ -248,7 +249,7 @@ size_t uxCount; /* Allocate storage of exactly the requested size to the buffer. */ configASSERT( pxReturn->pucEthernetBuffer == NULL ); - if( xRequestedSizeBytes > 0 ) + if( xRequestedSizeBytes > 0U ) { /* Extra space is obtained so a pointer to the network buffer can be stored at the beginning of the buffer. */