From b302bd5d288be2d3363b80053ca2392560b00b25 Mon Sep 17 00:00:00 2001 From: Ashok Bhat Date: Tue, 18 Feb 2014 11:40:00 +0000 Subject: 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 Signed-off-by: Ashok Bhat --- media/libeffects/lvm/wrapper/Bundle/EffectBundle.cpp | 20 ++++++++++---------- media/libeffects/lvm/wrapper/Reverb/EffectReverb.cpp | 14 +++++++------- 2 files changed, 17 insertions(+), 17 deletions(-) (limited to 'media/libeffects/lvm/wrapper') 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; -- cgit v1.1