From 172f46b87f972658279e2f017f567b9d6480ef2c Mon Sep 17 00:00:00 2001 From: njupthan Date: Thu, 27 Jan 2022 17:12:46 +0000 Subject: [PATCH] Modify the problem of incomplete dump output Signed-off-by: njupthan --- tools/dump/include/notification_shell_command.h | 7 +++---- tools/dump/src/notification_shell_command.cpp | 15 ++++++--------- 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/tools/dump/include/notification_shell_command.h b/tools/dump/include/notification_shell_command.h index bede4da7e..26fc5199e 100644 --- a/tools/dump/include/notification_shell_command.h +++ b/tools/dump/include/notification_shell_command.h @@ -34,12 +34,11 @@ private: ErrCode RunAsDumpCommand(); ErrCode RunHelp(); - ErrCode RunActive(); - ErrCode RunRecent(); + ErrCode RunActive(std::vector &infos); + ErrCode RunRecent(std::vector &infos); #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED - ErrCode RunDistributed(); + ErrCode RunDistributed(std::vector &infos); #endif - ErrCode RunSetRecentCount(); private: std::shared_ptr ans_; diff --git a/tools/dump/src/notification_shell_command.cpp b/tools/dump/src/notification_shell_command.cpp index 2d44785e7..97de8dd95 100644 --- a/tools/dump/src/notification_shell_command.cpp +++ b/tools/dump/src/notification_shell_command.cpp @@ -99,10 +99,9 @@ ErrCode NotificationShellCommand::RunHelp() return ERR_OK; } -ErrCode NotificationShellCommand::RunActive() +ErrCode NotificationShellCommand::RunActive(std::vector &infos) { ErrCode ret = ERR_OK; - std::vector infos; if (ans_ != nullptr) { ret = ans_->ShellDump("active", infos); resultReceiver_.append("Total:" + std::to_string(infos.size()) + "\n"); @@ -112,10 +111,9 @@ ErrCode NotificationShellCommand::RunActive() return ret; } -ErrCode NotificationShellCommand::RunRecent() +ErrCode NotificationShellCommand::RunRecent(std::vector &infos) { ErrCode ret = ERR_OK; - std::vector infos; if (ans_ != nullptr) { ret = ans_->ShellDump("recent", infos); resultReceiver_.append("Total:" + std::to_string(infos.size()) + "\n"); @@ -126,10 +124,9 @@ ErrCode NotificationShellCommand::RunRecent() } #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED -ErrCode NotificationShellCommand::RunDistributed() +ErrCode NotificationShellCommand::RunDistributed(std::vector &infos) { ErrCode ret = ERR_OK; - std::vector infos; if (ans_ != nullptr) { ret = ans_->ShellDump("distributed", infos); resultReceiver_.append("Total:" + std::to_string(infos.size()) + "\n"); @@ -157,14 +154,14 @@ ErrCode NotificationShellCommand::RunAsDumpCommand() ret = RunHelp(); break; case 'A': - ret = RunActive(); + ret = RunActive(infos); break; case 'R': - ret = RunRecent(); + ret = RunRecent(infos); break; #ifdef DISTRIBUTED_NOTIFICATION_SUPPORTED case 'D': - ret = RunDistributed(); + ret = RunDistributed(infos); break; #endif case 0: -- Gitee