From 0a74962182fe775f9232563bb4644d700596b4c3 Mon Sep 17 00:00:00 2001 From: bailu1992 Date: Tue, 16 Jan 2024 20:54:06 +0800 Subject: [PATCH] =?UTF-8?q?=E5=91=8A=E8=AD=A6=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: bailu1992 --- frameworks/src/sensor_agent_proxy.c | 7 ++++--- services/src/sensor_service.c | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/frameworks/src/sensor_agent_proxy.c b/frameworks/src/sensor_agent_proxy.c index 62c347c..e1f0101 100644 --- a/frameworks/src/sensor_agent_proxy.c +++ b/frameworks/src/sensor_agent_proxy.c @@ -130,7 +130,7 @@ int32_t GetSensorInfos(IOwner owner, IpcIo *reply) if (notify == NULL) { HILOG_ERROR(HILOG_MODULE_APP, "%s notify is null", __func__); return SENSOR_ERROR_INVALID_PARAM; - } else { + } else { ReadInt32(reply, &(notify->retCode)); if (notify->retCode < 0) { HILOG_ERROR(HILOG_MODULE_APP, "%s failed, retCode: %d", __func__, notify->retCode); @@ -153,8 +153,9 @@ int32_t GetSensorInfos(IOwner owner, IpcIo *reply) return SENSOR_ERROR_INVALID_PARAM; } for (int32_t i = 0; i < notify->count; i++) { - if (memcpy_s((*(notify->sensorInfo) + i), sizeof(SensorInfo), (sensorInfo + i), - sizeof(SensorInfo))) { + errno_t ret = memcpy_s((*(notify->sensorInfo) + i), sizeof(SensorInfo), (sensorInfo + i), + sizeof(SensorInfo)); + if (ret != EOK) { HILOG_ERROR(HILOG_MODULE_APP, "%s copy sensorInfo failed", __func__); free(*(notify->sensorInfo)); *(notify->sensorInfo) = NULL; diff --git a/services/src/sensor_service.c b/services/src/sensor_service.c index 1bfd09d..eae0551 100644 --- a/services/src/sensor_service.c +++ b/services/src/sensor_service.c @@ -132,7 +132,7 @@ int32_t UnsubscribeSensorInvoke(SensorFeatureApi *defaultApi, IpcIo *req, IpcIo HILOG_ERROR(HILOG_MODULE_APP, "[SERVICE:%s]: %s failed, defaultApi is null", SENSOR_SERVICE, __func__); WriteInt32(reply, SENSOR_ERROR_UNKNOWN); return SENSOR_ERROR_UNKNOWN; - } else { + } else { SensorUser sensorUser; int32_t ret = defaultApi->UnsubscribeSensor(sensorId, &sensorUser); WriteInt32(reply, ret); -- Gitee