mirror of
https://github.com/nyanmisaka/mpp.git
synced 2025-10-05 01:02:39 +08:00
[allocator]: Fix compiler warnings
Change-Id: I52554a3ca45747c13a7821a04bb1c01e45d9d44c Signed-off-by: Randy Li <randy.li@rock-chips.com> Signed-off-by: Herman Chen <herman.chen@rock-chips.com>
This commit is contained in:
@@ -37,7 +37,8 @@ typedef struct MppAllocatorApi_t {
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
MPP_RET mpp_allocator_get(MppAllocator *allocator, MppAllocatorApi **api, MppBufferType type);
|
MPP_RET mpp_allocator_get(MppAllocator *allocator,
|
||||||
|
MppAllocatorApi **api, MppBufferType type);
|
||||||
MPP_RET mpp_allocator_put(MppAllocator *allocator);
|
MPP_RET mpp_allocator_put(MppAllocator *allocator);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
|
@@ -35,7 +35,9 @@ typedef enum OsAllocatorApiId_e {
|
|||||||
ALLOC_API_BUTT,
|
ALLOC_API_BUTT,
|
||||||
} OsAllocatorApiId;
|
} OsAllocatorApiId;
|
||||||
|
|
||||||
static MPP_RET mpp_allocator_api_wrapper(MppAllocator allocator, MppBufferInfo *info, OsAllocatorApiId id)
|
static MPP_RET mpp_allocator_api_wrapper(MppAllocator allocator,
|
||||||
|
MppBufferInfo *info,
|
||||||
|
OsAllocatorApiId id)
|
||||||
{
|
{
|
||||||
if (NULL == allocator || NULL == info || id >= ALLOC_API_BUTT) {
|
if (NULL == allocator || NULL == info || id >= ALLOC_API_BUTT) {
|
||||||
mpp_err_f("invalid input: allocator %p info %p id %d\n",
|
mpp_err_f("invalid input: allocator %p info %p id %d\n",
|
||||||
@@ -77,42 +79,44 @@ static MPP_RET mpp_allocator_api_wrapper(MppAllocator allocator, MppBufferInfo *
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_allocator_alloc(MppAllocator allocator, MppBufferInfo *info)
|
static MPP_RET mpp_allocator_alloc(MppAllocator allocator, MppBufferInfo *info)
|
||||||
{
|
{
|
||||||
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_ALLOC);
|
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_ALLOC);
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_allocator_free(MppAllocator allocator, MppBufferInfo *info)
|
static MPP_RET mpp_allocator_free(MppAllocator allocator, MppBufferInfo *info)
|
||||||
{
|
{
|
||||||
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_FREE);
|
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_FREE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_allocator_import(MppAllocator allocator, MppBufferInfo *info)
|
static MPP_RET mpp_allocator_import(MppAllocator allocator, MppBufferInfo *info)
|
||||||
{
|
{
|
||||||
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_IMPORT);
|
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_IMPORT);
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_allocator_release(MppAllocator allocator, MppBufferInfo *info)
|
static MPP_RET mpp_allocator_release(MppAllocator allocator,
|
||||||
|
MppBufferInfo *info)
|
||||||
{
|
{
|
||||||
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_RELEASE);
|
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_RELEASE);
|
||||||
}
|
}
|
||||||
|
|
||||||
MPP_RET mpp_allocator_mmap(MppAllocator allocator, MppBufferInfo *info)
|
static MPP_RET mpp_allocator_mmap(MppAllocator allocator, MppBufferInfo *info)
|
||||||
{
|
{
|
||||||
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_MMAP);
|
return mpp_allocator_api_wrapper(allocator, info, ALLOC_API_MMAP);
|
||||||
}
|
}
|
||||||
|
|
||||||
static MppAllocatorApi mpp_allocator_api = {
|
static MppAllocatorApi mpp_allocator_api = {
|
||||||
sizeof(mpp_allocator_api),
|
.size = sizeof(mpp_allocator_api),
|
||||||
1,
|
.version = 1,
|
||||||
mpp_allocator_alloc,
|
.alloc = mpp_allocator_alloc,
|
||||||
mpp_allocator_free,
|
.free = mpp_allocator_free,
|
||||||
mpp_allocator_import,
|
.import = mpp_allocator_import,
|
||||||
mpp_allocator_release,
|
.release = mpp_allocator_release,
|
||||||
mpp_allocator_mmap,
|
.mmap = mpp_allocator_mmap,
|
||||||
};
|
};
|
||||||
|
|
||||||
MPP_RET mpp_allocator_get(MppAllocator *allocator, MppAllocatorApi **api, MppBufferType type)
|
MPP_RET mpp_allocator_get(MppAllocator *allocator,
|
||||||
|
MppAllocatorApi **api, MppBufferType type)
|
||||||
{
|
{
|
||||||
if (NULL == allocator || NULL == api || type >= MPP_BUFFER_TYPE_BUTT) {
|
if (NULL == allocator || NULL == api || type >= MPP_BUFFER_TYPE_BUTT) {
|
||||||
mpp_err_f("invalid input: allocator %p api %p type %d\n",
|
mpp_err_f("invalid input: allocator %p api %p type %d\n",
|
||||||
|
Reference in New Issue
Block a user