From 99d977d6600f22cbbf22a48d23ed655f56e22495 Mon Sep 17 00:00:00 2001 From: Hwankyu Jhun Date: Tue, 19 Sep 2023 10:54:20 +0900 Subject: [PATCH] Fix static analysis issues Issues: - COPY_INSTEAD_OF_MOVE Change-Id: Ie072a4808a2170dea24e337a5aaf7828e752763d Signed-off-by: Hwankyu Jhun --- benchmark/server/main.cc | 4 ++-- src/ac-internal.cc | 9 +++++---- utils/debug-port.cc | 2 +- 3 files changed, 8 insertions(+), 7 deletions(-) diff --git a/benchmark/server/main.cc b/benchmark/server/main.cc index 9be81a1..daac54c 100644 --- a/benchmark/server/main.cc +++ b/benchmark/server/main.cc @@ -35,12 +35,12 @@ class TestService : public bs::Benchmark::ServiceBase { std::unique_ptr CreateService(std::string sender, std::string instance) { return std::unique_ptr( - new TestService(sender, instance)); + new TestService(std::move(sender), std::move(instance))); } }; TestService(std::string sender, std::string instance) : - bs::Benchmark::ServiceBase(sender, instance) {} + bs::Benchmark::ServiceBase(std::move(sender), std::move(instance)) {} virtual ~TestService() = default; diff --git a/src/ac-internal.cc b/src/ac-internal.cc index 20b8974..7f21f8f 100644 --- a/src/ac-internal.cc +++ b/src/ac-internal.cc @@ -107,13 +107,14 @@ void AccessController::CheckAsync(int fd, std::string sender_appid, } int res = Check(fd, sender_appid); - auto* cbdata = new std::pair(callback, res); + auto* cbdata = new std::pair( + std::move(callback), res); guint sid = g_idle_add( [](gpointer data) -> gboolean { - auto* cbdata = static_cast*>(data); - auto [callback, res] = *cbdata; + auto* cb_data = static_cast*>(data); + auto [callback, res] = *cb_data; callback(res); - delete cbdata; + delete cb_data; return G_SOURCE_REMOVE; }, cbdata); if (sid == 0) { diff --git a/utils/debug-port.cc b/utils/debug-port.cc index 08a80ea..801f4c8 100644 --- a/utils/debug-port.cc +++ b/utils/debug-port.cc @@ -164,7 +164,7 @@ void DebugPort::OnDataReceived(int pid, rpc_port_parcel_h parcel) { delete[] buf; auto* msg = new Message(sent_time, pid, port_name, destination, is_delegate, - port, is_read, seq, data); + port, is_read, seq, std::move(data)); g_idle_add([](gpointer data) -> gboolean { auto* msg = static_cast(data); msg->Print(); -- 2.7.4