summaryrefslogtreecommitdiffstats
path: root/media/libeffects/lvm
diff options
context:
space:
mode:
authorAshok Bhat <ashok.bhat@arm.com>2014-02-18 11:40:00 +0000
committerAshok Bhat <ashok.bhat@arm.com>2014-02-20 14:12:49 +0000
commitb302bd5d288be2d3363b80053ca2392560b00b25 (patch)
tree7eaf242136ba86c73b7371e47475a2d7c5334847 /media/libeffects/lvm
parent80b72e6f4202ce26facbe51b8739814bca198a2c (diff)
downloadframeworks_av-b302bd5d288be2d3363b80053ca2392560b00b25.zip
frameworks_av-b302bd5d288be2d3363b80053ca2392560b00b25.tar.gz
frameworks_av-b302bd5d288be2d3363b80053ca2392560b00b25.tar.bz2
LP64 fixes for media/libeffects
Changes include: [x] In get parameter series of functions, replaced size_t* formal parameter type with uint32_t* where actual parameter passed was uint32_t*. [x] In set parameter series of functions, changed size_t formal parameter to uint32_t where actual parameter was uint32_t. [x] Changed the definition of LVM_UINT32 from unsigned long to uint32_t as unsigned long is 64-bit in LP64. [x] Used other stdint.h types for other LVM_types for consistency. [x] Use of uintptr_t for the pNextMember of the INST_ALLOC structure, rather than LVM_UINT32, for portablility. [x] Use of uintptr_t where pointers are used in arithmetic. [x] Replaced the use of 0xFFFFFFFC with ~3 in places where it was used to clear last two bits. [x] Removed int casts where cmdSize and *replySize, both uint32_t, were being compared with sizeof(). Change-Id: Ibec0b4d8e9b855f44b1cd853be6df84d13cf4186 Signed-off-by: Marcus Oakland <marcus.oakland@arm.com> Signed-off-by: Ashok Bhat <ashok.bhat@arm.com>
Diffstat (limited to 'media/libeffects/lvm')
-rw-r--r--media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c2
-rw-r--r--media/libeffects/lvm/lib/Bundle/src/LVM_Process.c2
-rw-r--r--media/libeffects/lvm/lib/Common/lib/InstAlloc.h2
-rw-r--r--media/libeffects/lvm/lib/Common/lib/LVM_Types.h13
-rw-r--r--media/libeffects/lvm/lib/Common/src/InstAlloc.c22
-rw-r--r--media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c2
-rw-r--r--media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp20
-rw-r--r--media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp14
8 files changed, 39 insertions, 38 deletions
diff --git a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
index 32c4ce0..35e5bc8 100644
--- a/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
+++ b/media/libeffects/lvm/lib/Bass/src/LVDBE_Init.c
@@ -178,7 +178,7 @@ LVDBE_ReturnStatus_en LVDBE_Init(LVDBE_Handle_t *phInstance,
{
return(LVDBE_NULLADDRESS);
}
- if (((LVM_UINT32)pMemoryTable->Region[i].pBaseAddress % pMemoryTable->Region[i].Alignment)!=0){
+ if (((uintptr_t)pMemoryTable->Region[i].pBaseAddress % pMemoryTable->Region[i].Alignment)!=0){
return(LVDBE_ALIGNMENTERROR);
}
}
diff --git a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
index 794271b..f5a01f3 100644
--- a/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
+++ b/media/libeffects/lvm/lib/Bundle/src/LVM_Process.c
@@ -99,7 +99,7 @@ LVM_ReturnStatus_en LVM_Process(LVM_Handle_t hInstance,
/*
* Check the buffer alignment
*/
- if((((LVM_UINT32)pInData % 4) != 0) || (((LVM_UINT32)pOutData % 4) != 0))
+ if((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
{
return(LVM_ALIGNMENTERROR);
}
diff --git a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
index c6954f2..7f725f4 100644
--- a/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
+++ b/media/libeffects/lvm/lib/Common/lib/InstAlloc.h
@@ -29,7 +29,7 @@ extern "C" {
typedef struct
{
LVM_UINT32 TotalSize; /* Accumulative total memory size */
- LVM_UINT32 pNextMember; /* Pointer to the next instance member to be allocated */
+ uintptr_t pNextMember; /* Pointer to the next instance member to be allocated */
} INST_ALLOC;
diff --git a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
index 81655dd..0c6fb25 100644
--- a/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
+++ b/media/libeffects/lvm/lib/Common/lib/LVM_Types.h
@@ -29,6 +29,7 @@
extern "C" {
#endif /* __cplusplus */
+#include <stdint.h>
/****************************************************************************************/
/* */
@@ -85,14 +86,14 @@ extern "C" {
typedef char LVM_CHAR; /* ASCII character */
-typedef char LVM_INT8; /* Signed 8-bit word */
-typedef unsigned char LVM_UINT8; /* Unsigned 8-bit word */
+typedef int8_t LVM_INT8; /* Signed 8-bit word */
+typedef uint8_t LVM_UINT8; /* Unsigned 8-bit word */
-typedef short LVM_INT16; /* Signed 16-bit word */
-typedef unsigned short LVM_UINT16; /* Unsigned 16-bit word */
+typedef int16_t LVM_INT16; /* Signed 16-bit word */
+typedef uint16_t LVM_UINT16; /* Unsigned 16-bit word */
-typedef long LVM_INT32; /* Signed 32-bit word */
-typedef unsigned long LVM_UINT32; /* Unsigned 32-bit word */
+typedef int32_t LVM_INT32; /* Signed 32-bit word */
+typedef uint32_t LVM_UINT32; /* Unsigned 32-bit word */
/****************************************************************************************/
diff --git a/media/libeffects/lvm/lib/Common/src/InstAlloc.c b/media/libeffects/lvm/lib/Common/src/InstAlloc.c
index 481df84..a89a5c3 100644
--- a/media/libeffects/lvm/lib/Common/src/InstAlloc.c
+++ b/media/libeffects/lvm/lib/Common/src/InstAlloc.c
@@ -30,7 +30,7 @@ void InstAlloc_Init( INST_ALLOC *pms,
void *StartAddr )
{
pms->TotalSize = 3;
- pms->pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);/* This code will fail if the platform address space is more than 32-bits*/
+ pms->pNextMember = (((uintptr_t)StartAddr + 3) & (uintptr_t)~3);
}
@@ -51,7 +51,7 @@ void* InstAlloc_AddMember( INST_ALLOC *pms,
void *NewMemberAddress; /* Variable to temporarily store the return value */
NewMemberAddress = (void*)pms->pNextMember;
- Size = ((Size + 3) & 0xFFFFFFFC); /* Ceil the size to a multiple of four */
+ Size = ((Size + 3) & (LVM_UINT32)~3); /* Ceil the size to a multiple of four */
pms->TotalSize += Size;
pms->pNextMember += Size;
@@ -84,30 +84,30 @@ LVM_UINT32 InstAlloc_GetTotal( INST_ALLOC *pms)
void InstAlloc_InitAll( INST_ALLOC *pms,
LVM_MemoryTable_st *pMemoryTable)
{
- LVM_UINT32 StartAddr;
+ uintptr_t StartAddr;
- StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress;
+ StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_SLOW_DATA].pBaseAddress;
pms[0].TotalSize = 3;
- pms[0].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
+ pms[0].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
- StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress;
+ StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_DATA].pBaseAddress;
pms[1].TotalSize = 3;
- pms[1].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
+ pms[1].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
- StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress;
+ StartAddr = (uintptr_t)pMemoryTable->Region[LVM_PERSISTENT_FAST_COEF].pBaseAddress;
pms[2].TotalSize = 3;
- pms[2].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
+ pms[2].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
- StartAddr = (LVM_UINT32)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress;
+ StartAddr = (uintptr_t)pMemoryTable->Region[LVM_TEMPORARY_FAST].pBaseAddress;
pms[3].TotalSize = 3;
- pms[3].pNextMember = (LVM_UINT32)(((LVM_UINT32)StartAddr + 3) & 0xFFFFFFFC);
+ pms[3].pNextMember = ((StartAddr + 3) & (uintptr_t)~3);
}
diff --git a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
index ac3c740..58f58ed 100644
--- a/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
+++ b/media/libeffects/lvm/lib/Eq/src/LVEQNB_Process.c
@@ -77,7 +77,7 @@ LVEQNB_ReturnStatus_en LVEQNB_Process(LVEQNB_Handle_t hInstance,
}
/* Check if the input and output data buffers are 32-bit aligned */
- if ((((LVM_INT32)pInData % 4) != 0) || (((LVM_INT32)pOutData % 4) != 0))
+ if ((((uintptr_t)pInData % 4) != 0) || (((uintptr_t)pOutData % 4) != 0))
{
return LVEQNB_ALIGNMENTERROR;
}
diff --git a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
index 58d7767..db5c78f 100644
--- a/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
+++ b/media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp
@@ -2813,9 +2813,9 @@ int Effect_command(effect_handle_t self,
if(pContext->EffectType == LVM_BASS_BOOST){
if (pCmdData == NULL ||
- cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
- *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
+ *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){
ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
@@ -2844,9 +2844,9 @@ int Effect_command(effect_handle_t self,
if(pContext->EffectType == LVM_VIRTUALIZER){
if (pCmdData == NULL ||
- cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
- *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
+ *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){
ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
@@ -2876,7 +2876,7 @@ int Effect_command(effect_handle_t self,
//ALOGV("\tEqualizer_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
if (pCmdData == NULL ||
- cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
*replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))) {
ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
@@ -2908,7 +2908,7 @@ int Effect_command(effect_handle_t self,
if(pContext->EffectType == LVM_VOLUME){
//ALOGV("\tVolume_command cmdCode Case: EFFECT_CMD_GET_PARAM start");
if (pCmdData == NULL ||
- cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
*replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
@@ -2947,7 +2947,7 @@ int Effect_command(effect_handle_t self,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
if (pCmdData == NULL||
- cmdSize != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
+ cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
pReplyData == NULL||
*replySize != sizeof(int32_t)){
ALOGV("\tLVM_ERROR : BassBoost_command cmdCode Case: "
@@ -2980,7 +2980,7 @@ int Effect_command(effect_handle_t self,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
if (pCmdData == NULL||
- cmdSize != (int)(sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
+ cmdSize != (sizeof(effect_param_t) + sizeof(int32_t) +sizeof(int16_t))||
pReplyData == NULL||
*replySize != sizeof(int32_t)){
ALOGV("\tLVM_ERROR : Virtualizer_command cmdCode Case: "
@@ -3014,7 +3014,7 @@ int Effect_command(effect_handle_t self,
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
- if (pCmdData == NULL || cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
+ if (pCmdData == NULL || cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Equalizer_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
@@ -3034,7 +3034,7 @@ int Effect_command(effect_handle_t self,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) +sizeof(int32_t)));
if ( pCmdData == NULL||
- cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t))||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t))||
pReplyData == NULL||
*replySize != sizeof(int32_t)){
ALOGV("\tLVM_ERROR : Volume_command cmdCode Case: "
diff --git a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
index 0367302..c6d3759 100644
--- a/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
+++ b/media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp
@@ -181,7 +181,7 @@ void Reverb_getConfig (ReverbContext *pContext, effect_config_t *pConfig);
int Reverb_setParameter (ReverbContext *pContext, void *pParam, void *pValue);
int Reverb_getParameter (ReverbContext *pContext,
void *pParam,
- size_t *pValueSize,
+ uint32_t *pValueSize,
void *pValue);
int Reverb_LoadPreset (ReverbContext *pContext);
@@ -1534,7 +1534,7 @@ int Reverb_LoadPreset(ReverbContext *pContext)
int Reverb_getParameter(ReverbContext *pContext,
void *pParam,
- size_t *pValueSize,
+ uint32_t *pValueSize,
void *pValue){
int status = 0;
int32_t *pParamTemp = (int32_t *)pParam;
@@ -1956,9 +1956,9 @@ int Reverb_command(effect_handle_t self,
//ALOGV("\tReverb_command cmdCode Case: "
// "EFFECT_CMD_GET_PARAM start");
if (pCmdData == NULL ||
- cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)) ||
+ cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)) ||
pReplyData == NULL ||
- *replySize < (int) (sizeof(effect_param_t) + sizeof(int32_t))){
+ *replySize < (sizeof(effect_param_t) + sizeof(int32_t))){
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
"EFFECT_CMD_GET_PARAM: ERROR");
return -EINVAL;
@@ -1973,7 +1973,7 @@ int Reverb_command(effect_handle_t self,
p->status = android::Reverb_getParameter(pContext,
(void *)p->data,
- (size_t *)&p->vsize,
+ &p->vsize,
p->data + voffset);
*replySize = sizeof(effect_param_t) + voffset + p->vsize;
@@ -1994,8 +1994,8 @@ int Reverb_command(effect_handle_t self,
// *replySize,
// *(int16_t *)((char *)pCmdData + sizeof(effect_param_t) + sizeof(int32_t)));
- if (pCmdData == NULL || (cmdSize < (int)(sizeof(effect_param_t) + sizeof(int32_t)))
- || pReplyData == NULL || *replySize != (int)sizeof(int32_t)) {
+ if (pCmdData == NULL || (cmdSize < (sizeof(effect_param_t) + sizeof(int32_t)))
+ || pReplyData == NULL || *replySize != sizeof(int32_t)) {
ALOGV("\tLVM_ERROR : Reverb_command cmdCode Case: "
"EFFECT_CMD_SET_PARAM: ERROR");
return -EINVAL;