mirror of
https://github.com/FreeRTOS/FreeRTOS-Kernel.git
synced 2025-08-20 01:58:32 -04:00
[Fix] Type for pointers operations (#550)
* fix type for pointers operations in some places: size_t -> portPOINTER_SIZE_TYPE * fix pointer arithmetics * fix xAddress type
This commit is contained in:
parent
ac69aa858a
commit
dc8f8be53e
3 changed files with 15 additions and 15 deletions
|
@ -442,10 +442,10 @@ static void prvInsertBlockIntoFreeList( BlockLink_t * pxBlockToInsert )
|
|||
void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
|
||||
{
|
||||
BlockLink_t * pxFirstFreeBlockInRegion = NULL, * pxPreviousFreeBlock;
|
||||
size_t xAlignedHeap;
|
||||
portPOINTER_SIZE_TYPE xAlignedHeap;
|
||||
size_t xTotalRegionSize, xTotalHeapSize = 0;
|
||||
BaseType_t xDefinedRegions = 0;
|
||||
size_t xAddress;
|
||||
portPOINTER_SIZE_TYPE xAddress;
|
||||
const HeapRegion_t * pxHeapRegion;
|
||||
|
||||
/* Can only call once! */
|
||||
|
@ -458,7 +458,7 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
|
|||
xTotalRegionSize = pxHeapRegion->xSizeInBytes;
|
||||
|
||||
/* Ensure the heap region starts on a correctly aligned boundary. */
|
||||
xAddress = ( size_t ) pxHeapRegion->pucStartAddress;
|
||||
xAddress = ( portPOINTER_SIZE_TYPE ) pxHeapRegion->pucStartAddress;
|
||||
|
||||
if( ( xAddress & portBYTE_ALIGNMENT_MASK ) != 0 )
|
||||
{
|
||||
|
@ -466,7 +466,7 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
|
|||
xAddress &= ~portBYTE_ALIGNMENT_MASK;
|
||||
|
||||
/* Adjust the size for the bytes lost to alignment. */
|
||||
xTotalRegionSize -= xAddress - ( size_t ) pxHeapRegion->pucStartAddress;
|
||||
xTotalRegionSize -= ( size_t ) ( xAddress - ( portPOINTER_SIZE_TYPE ) pxHeapRegion->pucStartAddress );
|
||||
}
|
||||
|
||||
xAlignedHeap = xAddress;
|
||||
|
@ -506,7 +506,7 @@ void vPortDefineHeapRegions( const HeapRegion_t * const pxHeapRegions )
|
|||
* sized to take up the entire heap region minus the space taken by the
|
||||
* free block structure. */
|
||||
pxFirstFreeBlockInRegion = ( BlockLink_t * ) xAlignedHeap;
|
||||
pxFirstFreeBlockInRegion->xBlockSize = xAddress - ( size_t ) pxFirstFreeBlockInRegion;
|
||||
pxFirstFreeBlockInRegion->xBlockSize = ( size_t ) ( xAddress - ( portPOINTER_SIZE_TYPE ) pxFirstFreeBlockInRegion );
|
||||
pxFirstFreeBlockInRegion->pxNextFreeBlock = pxEnd;
|
||||
|
||||
/* If this is not the first region that makes up the entire heap space
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue