From a710a452e4af099c4555ff5948dd1c0f650f73f4 Mon Sep 17 00:00:00 2001 From: fangJinliang1 Date: Mon, 31 Oct 2022 15:41:57 +0800 Subject: [PATCH] fixed f672f6c from https://gitee.com/fangJinliang1/notification_ans_standard/pulls/718 static check modify Signed-off-by: fangJinliang1 Change-Id: I8fd203fefd39c4b115ce08fec1ac3ec11dd5f73a --- frameworks/js/napi/src/subscribe.cpp | 2 +- services/ans/src/advanced_notification_service.cpp | 4 ++-- tools/dump/src/notification_shell_command.cpp | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/frameworks/js/napi/src/subscribe.cpp b/frameworks/js/napi/src/subscribe.cpp index dfe646ee1..c3d9eef18 100644 --- a/frameworks/js/napi/src/subscribe.cpp +++ b/frameworks/js/napi/src/subscribe.cpp @@ -101,8 +101,8 @@ napi_value SetSubscribeCallbackData(const napi_env &env, // vibrationValues?: Array napi_value arr = nullptr; napi_create_array(env, &arr); - uint32_t count = 0; if (request->EnableVibrate()) { + uint32_t count = 0; for (auto vec : request->GetVibrationStyle()) { napi_value nVibrationValue = nullptr; napi_create_int64(env, vec, &nVibrationValue); diff --git a/services/ans/src/advanced_notification_service.cpp b/services/ans/src/advanced_notification_service.cpp index c6d9f465d..0fc79793d 100644 --- a/services/ans/src/advanced_notification_service.cpp +++ b/services/ans/src/advanced_notification_service.cpp @@ -3687,7 +3687,7 @@ void AdvancedNotificationService::SendSubscribeHiSysEvent(int32_t pid, int32_t u eventInfo.userId = info->GetAppUserId(); std::vector appNames = info->GetAppNames(); eventInfo.bundleName = std::accumulate(appNames.begin(), appNames.end(), std::string(""), - [appNames](const std::string bundleName, const std::string &str) { + [appNames](const std::string &bundleName, const std::string &str) { return (str == appNames.front()) ? (bundleName + str) : (bundleName + "," + str); }); } @@ -3710,7 +3710,7 @@ void AdvancedNotificationService::SendUnSubscribeHiSysEvent(int32_t pid, int32_t eventInfo.userId = info->GetAppUserId(); std::vector appNames = info->GetAppNames(); eventInfo.bundleName = std::accumulate(appNames.begin(), appNames.end(), std::string(""), - [appNames](const std::string bundleName, const std::string &str) { + [appNames](const std::string &bundleName, const std::string &str) { return (str == appNames.front()) ? (bundleName + str) : (bundleName + "," + str); }); } diff --git a/tools/dump/src/notification_shell_command.cpp b/tools/dump/src/notification_shell_command.cpp index 0906e4684..1d4b04f71 100644 --- a/tools/dump/src/notification_shell_command.cpp +++ b/tools/dump/src/notification_shell_command.cpp @@ -244,7 +244,6 @@ void NotificationShellCommand::CheckDumpOpt() ErrCode NotificationShellCommand::RunAsSettingCommand() { - std::vector infos; int option = getopt_long(argc_, argv_, SETTING_SHORT_OPTIONS, SETTING_LONG_OPTIONS, nullptr); if (option == '?') { if (optopt == 'c') { @@ -264,6 +263,7 @@ ErrCode NotificationShellCommand::RunAsSettingCommand() resultReceiver_.append(SETTING_HELP_MSG); return ERR_INVALID_VALUE; } + std::vector infos; std::string cmd = COMMAND_SET_RECENT_COUNT; cmd.append(" ").append(std::string(optarg)); return RunDumpCmd(cmd, "", SUBSCRIBE_USER_INIT, infos); -- Gitee