From 3b51724fb2d89bb00508b8e04733fc34726d9ec4 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Sat, 26 Feb 2022 15:32:35 +0800 Subject: [PATCH 1/2] Signed-off-by:hellohyh001 Signed-off-by: hellohyh001 --- interfaces/plugin/src/sensor_napi_utils.cpp | 2 +- utils/include/sensor_channel_info.h | 2 +- utils/src/sensor_channel_info.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) mode change 100755 => 100644 utils/include/sensor_channel_info.h mode change 100755 => 100644 utils/src/sensor_channel_info.cpp diff --git a/interfaces/plugin/src/sensor_napi_utils.cpp b/interfaces/plugin/src/sensor_napi_utils.cpp index 2a706d70..b76cfd65 100644 --- a/interfaces/plugin/src/sensor_napi_utils.cpp +++ b/interfaces/plugin/src/sensor_napi_utils.cpp @@ -273,7 +273,7 @@ void ConvertToSensorData(napi_env env, AsyncCallbackInfo *asyncCallbackInfo, nap napi_get_undefined(env, &result[0]); int32_t sensorTypeId = asyncCallbackInfo->data.sensorData.sensorTypeId; if ((g_sensorAttributeList.count(sensorTypeId)) == 0 - || (static_cast(g_sensorAttributeList[sensorTypeId].size()) + || g_sensorAttributeList[sensorTypeId].size() > (asyncCallbackInfo->data.sensorData.dataLength / sizeof(float)))) { HiLog::Error(LABEL, "%{public}s count of sensorTypeId is zero", __func__); return; diff --git a/utils/include/sensor_channel_info.h b/utils/include/sensor_channel_info.h old mode 100755 new mode 100644 index 30084350..9698153c --- a/utils/include/sensor_channel_info.h +++ b/utils/include/sensor_channel_info.h @@ -35,7 +35,7 @@ public: int64_t GetSamplingPeriodNs() const; void SetSamplingPeriodNs(int64_t samplingPeriodNs); int32_t GetFifoCount() const; - void SetFifoCount(int32_t fifoCount); + void SetFifoCount(uint32_t fifoCount); std::vector GetCmdType() const; void SetCmdType(const std::vector &cmdType); diff --git a/utils/src/sensor_channel_info.cpp b/utils/src/sensor_channel_info.cpp old mode 100755 new mode 100644 index f844a45a..885c1f49 --- a/utils/src/sensor_channel_info.cpp +++ b/utils/src/sensor_channel_info.cpp @@ -65,7 +65,7 @@ int32_t SensorChannelInfo::GetFifoCount() const return fifoCount_; } -void SensorChannelInfo::SetFifoCount(int32_t fifoCount) +void SensorChannelInfo::SetFifoCount(uint32_t fifoCount) { fifoCount_ = fifoCount; } -- Gitee From 7eaa8f8defa576d2235af75e3aeb3cf3ad9f0066 Mon Sep 17 00:00:00 2001 From: hellohyh001 Date: Sat, 26 Feb 2022 15:56:27 +0800 Subject: [PATCH 2/2] Signed-off-by:hellohyh001 Signed-off-by: hellohyh001 --- interfaces/plugin/src/sensor_napi_utils.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/interfaces/plugin/src/sensor_napi_utils.cpp b/interfaces/plugin/src/sensor_napi_utils.cpp index b76cfd65..34eb1113 100644 --- a/interfaces/plugin/src/sensor_napi_utils.cpp +++ b/interfaces/plugin/src/sensor_napi_utils.cpp @@ -274,7 +274,7 @@ void ConvertToSensorData(napi_env env, AsyncCallbackInfo *asyncCallbackInfo, nap int32_t sensorTypeId = asyncCallbackInfo->data.sensorData.sensorTypeId; if ((g_sensorAttributeList.count(sensorTypeId)) == 0 || g_sensorAttributeList[sensorTypeId].size() - > (asyncCallbackInfo->data.sensorData.dataLength / sizeof(float)))) { + > (asyncCallbackInfo->data.sensorData.dataLength / sizeof(float))) { HiLog::Error(LABEL, "%{public}s count of sensorTypeId is zero", __func__); return; } -- Gitee