mirror of
https://github.com/openharmony/drivers_framework.git
synced 2026-07-22 04:05:29 -04:00
Deal with CodeDex warning
Signed-off-by: YOUR_NAME <guowen24@huawei.com>
This commit is contained in:
@@ -14,6 +14,13 @@
|
||||
#include "hdf_input_device_manager.h"
|
||||
#include "hdf_hid_adapter.h"
|
||||
|
||||
#define MEMCPY_CHECK_RETURN(ret) do { \
|
||||
if ((ret) != 0) { \
|
||||
HDF_LOGE("%s: memcpy failed, line %d", __func__, __LINE__); \
|
||||
return; \
|
||||
} \
|
||||
} while (0)
|
||||
|
||||
InputDevice *cachedHid[MAX_INPUT_DEV_NUM];
|
||||
HidInfo *g_cachedInfo[MAX_INPUT_DEV_NUM];
|
||||
|
||||
@@ -94,6 +101,7 @@ static void SetInputDevAbility(InputDevice *inputDev)
|
||||
HidInfo *info = NULL;
|
||||
int32_t id = 0;
|
||||
uint32_t len;
|
||||
int32_t ret;
|
||||
while (id < MAX_INPUT_DEV_NUM) {
|
||||
if(g_cachedInfo[id] != NULL && !strcmp(inputDev->devName, g_cachedInfo[id]->devName)) {
|
||||
info = g_cachedInfo[id];
|
||||
@@ -106,26 +114,36 @@ static void SetInputDevAbility(InputDevice *inputDev)
|
||||
return;
|
||||
}
|
||||
len = sizeof(unsigned long);
|
||||
memcpy_s(inputDev->abilitySet.devProp, len * BITS_TO_LONG(INPUT_PROP_CNT),
|
||||
ret = memcpy_s(inputDev->abilitySet.devProp, len * BITS_TO_LONG(INPUT_PROP_CNT),
|
||||
info->devProp, len * BITS_TO_LONG(INPUT_PROP_CNT));
|
||||
memcpy_s(inputDev->abilitySet.eventType, len * BITS_TO_LONG(EV_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.eventType, len * BITS_TO_LONG(EV_CNT),
|
||||
info->eventType, len * BITS_TO_LONG(EV_CNT));
|
||||
memcpy_s(inputDev->abilitySet.absCode, len * BITS_TO_LONG(ABS_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.absCode, len * BITS_TO_LONG(ABS_CNT),
|
||||
info->absCode, len * BITS_TO_LONG(ABS_CNT));
|
||||
memcpy_s(inputDev->abilitySet.relCode, len * BITS_TO_LONG(REL_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.relCode, len * BITS_TO_LONG(REL_CNT),
|
||||
info->relCode, len * BITS_TO_LONG(REL_CNT));
|
||||
memcpy_s(inputDev->abilitySet.keyCode, len * BITS_TO_LONG(KEY_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.keyCode, len * BITS_TO_LONG(KEY_CNT),
|
||||
info->keyCode, len * BITS_TO_LONG(KEY_CNT));
|
||||
memcpy_s(inputDev->abilitySet.ledCode, len * BITS_TO_LONG(LED_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.ledCode, len * BITS_TO_LONG(LED_CNT),
|
||||
info->ledCode, len * BITS_TO_LONG(LED_CNT));
|
||||
memcpy_s(inputDev->abilitySet.miscCode, len * BITS_TO_LONG(MSC_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.miscCode, len * BITS_TO_LONG(MSC_CNT),
|
||||
info->miscCode, len * BITS_TO_LONG(MSC_CNT));
|
||||
memcpy_s(inputDev->abilitySet.soundCode, len * BITS_TO_LONG(SND_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.soundCode, len * BITS_TO_LONG(SND_CNT),
|
||||
info->soundCode, len * BITS_TO_LONG(SND_CNT));
|
||||
memcpy_s(inputDev->abilitySet.forceCode, len * BITS_TO_LONG(FF_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.forceCode, len * BITS_TO_LONG(FF_CNT),
|
||||
info->forceCode, len * BITS_TO_LONG(FF_CNT));
|
||||
memcpy_s(inputDev->abilitySet.switchCode, len * BITS_TO_LONG(SW_CNT),
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
ret = memcpy_s(inputDev->abilitySet.switchCode, len * BITS_TO_LONG(SW_CNT),
|
||||
info->switchCode, len * BITS_TO_LONG(SW_CNT));
|
||||
MEMCPY_CHECK_RETURN(ret);
|
||||
|
||||
inputDev->attrSet.id.busType = info->bustype;
|
||||
inputDev->attrSet.id.vendor = info->vendor;
|
||||
|
||||
@@ -91,10 +91,10 @@ static int32_t CreateDeviceNode(InputDevice *inputDev)
|
||||
if (IsHidDevice(inputDev->devType)) {
|
||||
HDF_LOGI("%s: prepare to register hdf device", __func__);
|
||||
inputDev->hdfDevObj = HidRegisterHdfDevice(inputDev);
|
||||
inputDev->hdfDevObj->priv = (void *)inputDev;
|
||||
if (inputDev->hdfDevObj == NULL) {
|
||||
return HDF_DEV_ERR_NO_DEVICE;
|
||||
}
|
||||
inputDev->hdfDevObj->priv = (void *)inputDev;
|
||||
}
|
||||
|
||||
HDF_LOGI("%s: create node succ, devId is %d ", __func__, inputDev->devId);
|
||||
|
||||
@@ -393,7 +393,7 @@ static int32_t TouchGetDevType(TouchDriver *driver, struct HdfSBuf *reply)
|
||||
|
||||
static int32_t TouchSetPowerStatus(TouchDriver *driver, struct HdfSBuf *data)
|
||||
{
|
||||
uint32_t pwrStatus;
|
||||
uint32_t pwrStatus = 0;
|
||||
bool ret = HdfSbufReadUint32(data, &pwrStatus);
|
||||
if (!ret) {
|
||||
HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__);
|
||||
@@ -483,7 +483,7 @@ static int32_t TouchGetDeviceAbility(TouchDriver *driver, struct HdfSBuf *reply)
|
||||
|
||||
static int32_t TouchSetGestureMode(TouchDriver *driver, struct HdfSBuf *data)
|
||||
{
|
||||
uint32_t gestureMode;
|
||||
uint32_t gestureMode = 0;
|
||||
bool ret = HdfSbufReadUint32(data, &gestureMode);
|
||||
if (!ret) {
|
||||
HDF_LOGE("%s: HdfSbufWriteUint32 failed", __func__);
|
||||
|
||||
Reference in New Issue
Block a user