From 189fb3b69d08ae71e844879defd807de0be550a3 Mon Sep 17 00:00:00 2001 From: li-yaoyao777 Date: Tue, 11 Feb 2025 15:08:10 +0800 Subject: [PATCH] vibrator alarm scan modification Signed-off-by: li-yaoyao777 --- frameworks/js/napi/vibrator/src/vibrator_js.cpp | 4 ++-- frameworks/native/vibrator/src/vibrator_service_client.cpp | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/js/napi/vibrator/src/vibrator_js.cpp b/frameworks/js/napi/vibrator/src/vibrator_js.cpp index bcec8e5..0e678f9 100644 --- a/frameworks/js/napi/vibrator/src/vibrator_js.cpp +++ b/frameworks/js/napi/vibrator/src/vibrator_js.cpp @@ -273,7 +273,7 @@ static bool ParseVibrateEvent(napi_env env, napi_value eventArray, int32_t index uint32_t pointsLength = 0; CHKCF((napi_get_array_length(env, pointsArray, &pointsLength) == napi_ok), "napi_get_array_length pointsArray fail"); - event.pointNum = pointsLength; + event.pointNum = static_cast(pointsLength); if (pointsLength > 0) { if (!ParseVibratorCurvePointArray(env, pointsArray, pointsLength, event)) { MISC_HILOGE("ParseVibratorCurvePointArray failed"); @@ -296,7 +296,7 @@ static bool ParseVibratorPattern(napi_env env, napi_value args[], VibrateInfo &i CHKCF(IsMatchArrayType(env, eventArray), "Wrong argument type, Napi array expected"); uint32_t length = 0; CHKCF((napi_get_array_length(env, eventArray, &length) == napi_ok), "napi_get_array_length fail"); - info.vibratorPattern.eventNum = length; + info.vibratorPattern.eventNum = static_cast(length); if (length <= 0 || length > EVENT_NUM_MAX) { MISC_HILOGE("length should not be less than or equal to 0 or greater than EVENT_NUM_MAX"); return false; diff --git a/frameworks/native/vibrator/src/vibrator_service_client.cpp b/frameworks/native/vibrator/src/vibrator_service_client.cpp index 455efce..ab9b01b 100644 --- a/frameworks/native/vibrator/src/vibrator_service_client.cpp +++ b/frameworks/native/vibrator/src/vibrator_service_client.cpp @@ -609,7 +609,7 @@ void VibratorServiceClient::ConvertSeekVibratorPackage(const VibratorPackage &co vibrateEvent.intensity = completePackage.patterns[i].events[j].intensity; vibrateEvent.frequency = completePackage.patterns[i].events[j].frequency; vibrateEvent.index = completePackage.patterns[i].events[j].index; - for (size_t k = 0; k < completePackage.patterns[i].events[j].pointNum; ++k) { + for (size_t k = 0; k < static_cast(completePackage.patterns[i].events[j].pointNum); ++k) { VibrateCurvePoint vibrateCurvePoint = {}; vibrateCurvePoint.time = completePackage.patterns[i].events[j].points[k].time; vibrateCurvePoint.intensity = completePackage.patterns[i].events[j].points[k].intensity; @@ -639,7 +639,7 @@ void VibratorServiceClient::ConvertVibratorPattern(const VibratorPattern &vibrat vibrateEvent.intensity = vibratorPattern.events[j].intensity; vibrateEvent.frequency = vibratorPattern.events[j].frequency; vibrateEvent.index = vibratorPattern.events[j].index; - for (size_t k = 0; k < vibratorPattern.events[j].pointNum; ++k) { + for (size_t k = 0; k < static_cast(vibratorPattern.events[j].pointNum); ++k) { VibrateCurvePoint vibrateCurvePoint = {}; vibrateCurvePoint.time = vibratorPattern.events[j].points[k].time; vibrateCurvePoint.intensity = vibratorPattern.events[j].points[k].intensity; -- Gitee