Skip to content

Commit

Permalink
修复 _bGetUsableSize 参数导致的编译报错问题;
Browse files Browse the repository at this point in the history
  • Loading branch information
chenhaimeng committed Jul 3, 2024
1 parent d302169 commit 24909ad
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bos/utils/b_util_memp.c
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ static uint32_t _bGetFreeSize()
return ret;
}

static uint32_t _bGetUsableSize(void *addr)
static uint32_t _bGetUsableSize(uint32_t addr)
{
bMempUnitHead_t *phead = (bMempUnitHead_t *)(addr - sizeof(bMempUnitHead_t));
if (phead->status != MEMP_UNIT_USED ||
Expand Down Expand Up @@ -295,7 +295,7 @@ static void *_bRealloc(void *paddr, uint32_t size)
{
return NULL;
}
uint32_t old_size = _bGetUsableSize(paddr);
uint32_t old_size = _bGetUsableSize((uint32_t)paddr);
uint32_t copy_size = (size < old_size) ? size : old_size;
memcpy(new_ptr, paddr, copy_size);
bFree(paddr);
Expand Down Expand Up @@ -354,7 +354,7 @@ void *bRealloc(void *paddr, uint32_t size)
{
return NULL;
}
uint32_t old_size = _bGetUsableSize(paddr);
uint32_t old_size = _bGetUsableSize((uint32_t)paddr);
uint32_t copy_size = (size < old_size) ? size : old_size;
memcpy(new_ptr, paddr, copy_size);
bFree(paddr);
Expand Down

0 comments on commit 24909ad

Please sign in to comment.