From 6e93876d293b336dc8d2492ea2bd86f99efb6d74 Mon Sep 17 00:00:00 2001 From: guduhanyan Date: Tue, 28 Sep 2021 21:46:34 +0800 Subject: [PATCH] 20210928LTS04 Signed-off-by: guduhanyan --- .../kits/js/napi/system_timer/src/system_timer.cpp | 8 ++++---- services/time_manager/src/time_service.cpp | 10 ++++++---- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/interfaces/kits/js/napi/system_timer/src/system_timer.cpp b/interfaces/kits/js/napi/system_timer/src/system_timer.cpp index d4ccf86..d0bd3be 100644 --- a/interfaces/kits/js/napi/system_timer/src/system_timer.cpp +++ b/interfaces/kits/js/napi/system_timer/src/system_timer.cpp @@ -342,7 +342,7 @@ void PaddingAsyncCallbackInfoIsByCreateTimer( napi_value CreateTimer(napi_env env, napi_callback_info info) { size_t argc = CREATE_MAX_PARA; - napi_value argv[CREATE_MAX_PARA]; + napi_value argv[CREATE_MAX_PARA] = {0}; napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); std::shared_ptr iTimerInfoInstance = std::make_shared(); @@ -444,7 +444,7 @@ void PaddingAsyncCallbackInfoIsByStartTimer( napi_value StartTimer(napi_env env, napi_callback_info info) { size_t argc = START_MAX_PARA; - napi_value argv[START_MAX_PARA]; + napi_value argv[START_MAX_PARA] = {0}; napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); @@ -552,7 +552,7 @@ void PaddingAsyncCallbackInfoIsByStopTimer( napi_value StopTimer(napi_env env, napi_callback_info info) { size_t argc = STOP_MAX_PARA; - napi_value argv[STOP_MAX_PARA]; + napi_value argv[STOP_MAX_PARA] = {0}; napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); @@ -657,7 +657,7 @@ void PaddingAsyncCallbackInfoIsByDestroyTimer( napi_value DestroyTimer(napi_env env, napi_callback_info info) { size_t argc = DESTROY_MAX_PARA; - napi_value argv[DESTROY_MAX_PARA]; + napi_value argv[DESTROY_MAX_PARA] = {0}; napi_value thisVar = nullptr; NAPI_CALL(env, napi_get_cb_info(env, info, &argc, argv, &thisVar, NULL)); diff --git a/services/time_manager/src/time_service.cpp b/services/time_manager/src/time_service.cpp index 84fd622..edc4f7d 100644 --- a/services/time_manager/src/time_service.cpp +++ b/services/time_manager/src/time_service.cpp @@ -173,14 +173,15 @@ void TimeService::PaserTimerPara(int32_t type, bool repeat, uint64_t interval, T { bool isRealtime = false; bool isWakeup = false; + auto uIntType = static_cast(type); paras.flag = 0; - if ((type & TIMER_TYPE_REALTIME_MASK) > 0 ) { + if ((uIntType & TIMER_TYPE_REALTIME_MASK) > 0) { isRealtime = true; } - if ((type & TIMER_TYPE_REALTIME_WAKEUP_MASK) > 0) { + if ((uIntType & TIMER_TYPE_REALTIME_WAKEUP_MASK) > 0) { isWakeup = true; } - if ((type & TIMER_TYPE_EXACT_MASK) > 0) { + if ((uIntType & TIMER_TYPE_EXACT_MASK) > 0) { paras.windowLength = 0; }else{ paras.windowLength = -1; @@ -341,7 +342,8 @@ int TimeService::set_rtc_time(time_t sec) { strs << "/dev/rtc" << rtc_id; auto rtc_dev = strs.str(); TIME_HILOGI(TIME_MODULE_SERVICE, "rtc_dev : %{public}s:", rtc_dev.data()); - fd = open(rtc_dev.data(), O_RDWR); + auto rtc_data = rtc_dev.data(); + fd = open(rtc_data, O_RDWR); if (fd < 0) { TIME_HILOGE(TIME_MODULE_SERVICE, "open failed %{public}s: %{public}s", rtc_dev.data(), strerror(errno)); return -1;