From 375015b6f15e4c9277065ac292a1b904581ca24b Mon Sep 17 00:00:00 2001 From: li-tiangang4 Date: Sun, 28 Apr 2024 17:30:54 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9cppcheck=E5=91=8A=E8=AD=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: li-tiangang4 --- frameworks/include/i_input_node_listener.h | 10 ++++----- frameworks/include/i_sharing_dhid_listener.h | 6 +++--- .../unittest/distributed_input_inner_test.cpp | 10 ++++----- .../unittest/distributed_input_inner_test.h | 10 ++++----- .../ipc/include/distributed_input_client.h | 4 ++-- .../ipc/include/input_node_listener_proxy.h | 10 ++++----- .../ipc/include/sharing_dhid_listener_proxy.h | 6 +++--- .../ipc/src/distributed_input_client.cpp | 4 ++-- .../ipc/src/input_node_listener_proxy.cpp | 10 ++++----- .../ipc/src/sharing_dhid_listener_proxy.cpp | 4 ++-- .../add_white_list_infos_call_back_test.cpp | 12 +++++------ .../add_white_list_infos_call_back_test.h | 14 ++++++------- .../distributed_input_client_test.cpp | 10 ++++----- .../distributed_input_client_test.h | 10 ++++----- .../dinput_source_callback_unittest.cpp | 8 +++---- .../dinput_source_callback_unittest.h | 10 ++++----- .../distributedinputstub_fuzzer.cpp | 21 +++++++++++++------ .../distributed_input_ipc_test.cpp | 10 ++++----- .../ipcunittest/distributed_input_ipc_test.h | 10 ++++----- .../distributed_input_sinkmanager_test.cpp | 4 ++-- .../distributed_input_sinkmanager_test.h | 6 +++--- .../distributed_input_sourceinject_test.cpp | 8 +++---- .../distributed_input_sourceinject_test.h | 6 +++--- .../distributed_input_sourcemanager_test.cpp | 8 +++---- .../distributed_input_sourcemanager_test.h | 10 ++++----- 25 files changed, 115 insertions(+), 106 deletions(-) diff --git a/frameworks/include/i_input_node_listener.h b/frameworks/include/i_input_node_listener.h index c839778..0dca958 100644 --- a/frameworks/include/i_input_node_listener.h +++ b/frameworks/include/i_input_node_listener.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,11 +25,11 @@ namespace DistributedHardware { namespace DistributedInput { class InputNodeListener : public IRemoteBroker { public: - virtual void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc) = 0; + virtual void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc) = 0; - virtual void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId) = 0; + virtual void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId) = 0; enum class Message { RESULT_ON, RESULT_OFF }; diff --git a/frameworks/include/i_sharing_dhid_listener.h b/frameworks/include/i_sharing_dhid_listener.h index 13c9aff..deaa093 100644 --- a/frameworks/include/i_sharing_dhid_listener.h +++ b/frameworks/include/i_sharing_dhid_listener.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -25,8 +25,8 @@ namespace DistributedHardware { namespace DistributedInput { class ISharingDhIdListener : public IRemoteBroker { public: - virtual int32_t OnSharing(std::string dhId) = 0; - virtual int32_t OnNoSharing(std::string dhId) = 0; + virtual int32_t OnSharing(const std::string &dhId) = 0; + virtual int32_t OnNoSharing(const std::string &dhId) = 0; enum class Message { SHARING, diff --git a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp index 5b56f2e..34739c5 100644 --- a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp +++ b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -85,8 +85,8 @@ void DistributedInputInnerTest::TestStartStopDInputCallback::OnResultDhids( return; } -void DistributedInputInnerTest::TestInputNodeListener::OnNodeOnLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) +void DistributedInputInnerTest::TestInputNodeListener::OnNodeOnLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc) { (void)srcDevId; (void)sinkDevId; @@ -95,8 +95,8 @@ void DistributedInputInnerTest::TestInputNodeListener::OnNodeOnLine(const std::s return; } -void DistributedInputInnerTest::TestInputNodeListener::OnNodeOffLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId) +void DistributedInputInnerTest::TestInputNodeListener::OnNodeOffLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId) { (void)srcDevId; (void)sinkDevId; diff --git a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h index 2060897..e9a64b6 100644 --- a/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h +++ b/interfaces/inner_kits/test/unittest/distributed_input_inner_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -96,11 +96,11 @@ public: public: TestInputNodeListener() = default; virtual ~TestInputNodeListener() = default; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc); + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc); - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId); + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId); }; class TestSimulationEventListenerStub : public diff --git a/interfaces/ipc/include/distributed_input_client.h b/interfaces/ipc/include/distributed_input_client.h index 3a694a2..6fe7865 100644 --- a/interfaces/ipc/include/distributed_input_client.h +++ b/interfaces/ipc/include/distributed_input_client.h @@ -150,8 +150,8 @@ public: public: SharingDhIdListenerCb() = default; ~SharingDhIdListenerCb() override = default; - int32_t OnSharing(std::string dhId) override; - int32_t OnNoSharing(std::string dhId) override; + int32_t OnSharing(const std::string &dhId) override; + int32_t OnNoSharing(const std::string &dhId) override; }; class GetSinkScreenInfosCb : public OHOS::DistributedHardware::DistributedInput::GetSinkScreenInfosCallbackStub { diff --git a/interfaces/ipc/include/input_node_listener_proxy.h b/interfaces/ipc/include/input_node_listener_proxy.h index 45b8de3..8a60eaf 100644 --- a/interfaces/ipc/include/input_node_listener_proxy.h +++ b/interfaces/ipc/include/input_node_listener_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,11 +30,11 @@ public: explicit InputNodeListenerProxy(const sptr &object); ~InputNodeListenerProxy() override; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc) override; + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc) override; - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId) override; + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/include/sharing_dhid_listener_proxy.h b/interfaces/ipc/include/sharing_dhid_listener_proxy.h index 8e3bcbd..7a94176 100644 --- a/interfaces/ipc/include/sharing_dhid_listener_proxy.h +++ b/interfaces/ipc/include/sharing_dhid_listener_proxy.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,8 +30,8 @@ public: explicit SharingDhIdListenerProxy(const sptr &object); ~SharingDhIdListenerProxy() override; - int32_t OnSharing(std::string dhId) override; - int32_t OnNoSharing(std::string dhId) override; + int32_t OnSharing(const std::string &dhId) override; + int32_t OnNoSharing(const std::string &dhId) override; private: static inline BrokerDelegator delegator_; diff --git a/interfaces/ipc/src/distributed_input_client.cpp b/interfaces/ipc/src/distributed_input_client.cpp index 83b2125..ecb71f8 100644 --- a/interfaces/ipc/src/distributed_input_client.cpp +++ b/interfaces/ipc/src/distributed_input_client.cpp @@ -101,7 +101,7 @@ void DistributedInputClient::GetSinkScreenInfosCb::OnResult(const std::string &s } } -int32_t DistributedInputClient::SharingDhIdListenerCb::OnSharing(std::string dhId) +int32_t DistributedInputClient::SharingDhIdListenerCb::OnSharing(const std::string &dhId) { std::lock_guard lock(DistributedInputClient::GetInstance().sharingDhIdsMtx_); DHLOGI("Add Sharing Local dhId: %{public}s", GetAnonyString(dhId).c_str()); @@ -109,7 +109,7 @@ int32_t DistributedInputClient::SharingDhIdListenerCb::OnSharing(std::string dhI return DH_SUCCESS; } -int32_t DistributedInputClient::SharingDhIdListenerCb::OnNoSharing(std::string dhId) +int32_t DistributedInputClient::SharingDhIdListenerCb::OnNoSharing(const std::string &dhId) { std::lock_guard lock(DistributedInputClient::GetInstance().sharingDhIdsMtx_); DHLOGI("Remove No Sharing Local dhId: %{public}s", GetAnonyString(dhId).c_str()); diff --git a/interfaces/ipc/src/input_node_listener_proxy.cpp b/interfaces/ipc/src/input_node_listener_proxy.cpp index 75e3497..2d12876 100644 --- a/interfaces/ipc/src/input_node_listener_proxy.cpp +++ b/interfaces/ipc/src/input_node_listener_proxy.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -30,8 +30,8 @@ InputNodeListenerProxy::InputNodeListenerProxy(const sptr &object InputNodeListenerProxy::~InputNodeListenerProxy() {} -void InputNodeListenerProxy::OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc) +void InputNodeListenerProxy::OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc) { sptr remote = Remote(); if (remote == nullptr) { @@ -68,8 +68,8 @@ void InputNodeListenerProxy::OnNodeOnLine(const std::string srcDevId, const std: } } -void InputNodeListenerProxy::OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId) +void InputNodeListenerProxy::OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId) { sptr remote = Remote(); if (remote == nullptr) { diff --git a/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp b/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp index 3a7f447..2d2e912 100644 --- a/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp +++ b/interfaces/ipc/src/sharing_dhid_listener_proxy.cpp @@ -31,7 +31,7 @@ SharingDhIdListenerProxy::SharingDhIdListenerProxy(const sptr &ob SharingDhIdListenerProxy::~SharingDhIdListenerProxy() {} -int32_t SharingDhIdListenerProxy::OnSharing(std::string dhId) +int32_t SharingDhIdListenerProxy::OnSharing(const std::string &dhId) { int32_t result = ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; sptr remote = Remote(); @@ -62,7 +62,7 @@ int32_t SharingDhIdListenerProxy::OnSharing(std::string dhId) return result; } -int32_t SharingDhIdListenerProxy::OnNoSharing(std::string dhId) +int32_t SharingDhIdListenerProxy::OnNoSharing(const std::string &dhId) { int32_t result = ERR_DH_INPUT_IPC_WRITE_TOKEN_VALID_FAIL; sptr remote = Remote(); diff --git a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp index 471114a..744d50e 100644 --- a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp +++ b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.cpp @@ -76,8 +76,8 @@ void AddWhiteListInfosCallbackTest::TestGetSinkScreenInfosCallbackStub::OnResult strJson_ = strJson; } -void AddWhiteListInfosCallbackTest::TestInputNodeListenerStub::OnNodeOnLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) +void AddWhiteListInfosCallbackTest::TestInputNodeListenerStub::OnNodeOnLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc) { srcDevId_ = srcDevId; sinkDevId_ = sinkDevId; @@ -85,8 +85,8 @@ void AddWhiteListInfosCallbackTest::TestInputNodeListenerStub::OnNodeOnLine(cons sinkNodeDesc_ = sinkNodeDesc; } -void AddWhiteListInfosCallbackTest::TestInputNodeListenerStub::OnNodeOffLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId) +void AddWhiteListInfosCallbackTest::TestInputNodeListenerStub::OnNodeOffLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId) { srcDevId_ = srcDevId; sinkDevId_ = sinkDevId; @@ -108,13 +108,13 @@ void AddWhiteListInfosCallbackTest::TestRegisterDInputCallbackStub::OnResult(con status_ = status; } -int32_t AddWhiteListInfosCallbackTest::TestSharingDhIdListenerStub::OnSharing(std::string dhId) +int32_t AddWhiteListInfosCallbackTest::TestSharingDhIdListenerStub::OnSharing(const std::string &dhId) { dhId_ = dhId; return DH_SUCCESS; } -int32_t AddWhiteListInfosCallbackTest::TestSharingDhIdListenerStub::OnNoSharing(std::string dhId) +int32_t AddWhiteListInfosCallbackTest::TestSharingDhIdListenerStub::OnNoSharing(const std::string &dhId) { dhId_ = dhId; return DH_SUCCESS; diff --git a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h index 624f12c..9acf996 100644 --- a/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h +++ b/interfaces/ipc/test/addwhitelistinfoscallbackunittest/add_white_list_infos_call_back_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -77,11 +77,11 @@ public: public: TestInputNodeListenerStub() = default; virtual ~TestInputNodeListenerStub() = default; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc); + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc); - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId); + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId); std::string srcDevId_; std::string sinkDevId_; std::string sinkNodeId_; @@ -114,8 +114,8 @@ public: public: TestSharingDhIdListenerStub() = default; virtual ~TestSharingDhIdListenerStub() = default; - int32_t OnSharing(std::string dhId); - int32_t OnNoSharing(std::string dhId); + int32_t OnSharing(const std::string &dhId); + int32_t OnNoSharing(const std::string &dhId); std::string dhId_; }; diff --git a/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp b/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp index d08527b..b1391ee 100644 --- a/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp +++ b/interfaces/ipc/test/clientunittest/distributed_input_client_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -123,8 +123,8 @@ void DistributedInputClientTest::TestStartStopDInputCallback::OnResultDhids( return; } -void DistributedInputClientTest::TestInputNodeListener::OnNodeOnLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) +void DistributedInputClientTest::TestInputNodeListener::OnNodeOnLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc) { (void)srcDevId; (void)sinkDevId; @@ -133,8 +133,8 @@ void DistributedInputClientTest::TestInputNodeListener::OnNodeOnLine(const std:: return; } -void DistributedInputClientTest::TestInputNodeListener::OnNodeOffLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId) +void DistributedInputClientTest::TestInputNodeListener::OnNodeOffLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId) { (void)srcDevId; (void)sinkDevId; diff --git a/interfaces/ipc/test/clientunittest/distributed_input_client_test.h b/interfaces/ipc/test/clientunittest/distributed_input_client_test.h index 09c674b..8c91135 100644 --- a/interfaces/ipc/test/clientunittest/distributed_input_client_test.h +++ b/interfaces/ipc/test/clientunittest/distributed_input_client_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -106,11 +106,11 @@ public: public: TestInputNodeListener() = default; virtual ~TestInputNodeListener() = default; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc); + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc); - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId); + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId); }; class TestSimulationEventListenerStub : public diff --git a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp index ad70fcc..c278181 100644 --- a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp +++ b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.cpp @@ -338,8 +338,8 @@ void DInputSourceCallBackTest::TestDelWhiteListInfosCallBack::OnResult( return; } -void DInputSourceCallBackTest::TestDInputNodeListenerCallBack::OnNodeOnLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) +void DInputSourceCallBackTest::TestDInputNodeListenerCallBack::OnNodeOnLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc) { (void)srcDevId; (void)sinkDevId; @@ -348,8 +348,8 @@ void DInputSourceCallBackTest::TestDInputNodeListenerCallBack::OnNodeOnLine(cons return; } -void DInputSourceCallBackTest::TestDInputNodeListenerCallBack::OnNodeOffLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId) +void DInputSourceCallBackTest::TestDInputNodeListenerCallBack::OnNodeOffLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId) { (void)srcDevId; (void)sinkDevId; diff --git a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h index 3ee72e9..fccf608 100644 --- a/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h +++ b/interfaces/ipc/test/dinputsourcecallbackunittest/dinput_source_callback_unittest.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -185,11 +185,11 @@ public: public: TestDInputNodeListenerCallBack() = default; virtual ~TestDInputNodeListenerCallBack() = default; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc); + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc); - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId); + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId); }; class TestDInputSimulationEventCallBack : public diff --git a/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.cpp b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.cpp index 50264ef..7730fa8 100644 --- a/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.cpp +++ b/interfaces/ipc/test/fuzztest/distributedinputstub_fuzzer/distributedinputstub_fuzzer.cpp @@ -456,15 +456,22 @@ void GetSinkScreenInfosCallbackStubFuzzTest(const uint8_t *data, size_t size) class MyInputNodeListenerStub : public DistributedInput::InputNodeListenerStub { public: - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc) override + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc) override { + (void)srcDevId; + (void)sinkDevId; + (void)sinkNodeId; + (void)sinkNodeDesc; return; } - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId) override + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId) override { + (void)srcDevId; + (void)sinkDevId; + (void)sinkNodeId; return; } }; @@ -615,13 +622,15 @@ void RegisterSessionStateCallbackStubFuzzTest(const uint8_t *data, size_t size) class MySharingDhIdListenerStub : public DistributedInput::SharingDhIdListenerStub { public: - int32_t OnSharing(std::string dhId) override + int32_t OnSharing(const std::string &dhId) override { + (void)dhId; return 0; } - int32_t OnNoSharing(std::string dhId) override + int32_t OnNoSharing(const std::string &dhId) override { + (void)dhId; return 0; } }; diff --git a/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp b/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp index 11ce0d6..8274941 100644 --- a/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp +++ b/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.cpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022-2023 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -41,8 +41,8 @@ void DistributedInputIpcTest::TearDownTestCase() { } -void DistributedInputIpcTest::TestInputNodeListener::OnNodeOnLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) +void DistributedInputIpcTest::TestInputNodeListener::OnNodeOnLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc) { (void)srcDevId; (void)sinkDevId; @@ -51,8 +51,8 @@ void DistributedInputIpcTest::TestInputNodeListener::OnNodeOnLine(const std::str return; } -void DistributedInputIpcTest::TestInputNodeListener::OnNodeOffLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId) +void DistributedInputIpcTest::TestInputNodeListener::OnNodeOffLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId) { (void)srcDevId; (void)sinkDevId; diff --git a/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.h b/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.h index a04b921..f8b379d 100644 --- a/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.h +++ b/interfaces/ipc/test/ipcunittest/distributed_input_ipc_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2022 Huawei Device Co., Ltd. + * Copyright (c) 2022-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -45,11 +45,11 @@ public: public: TestInputNodeListener() = default; virtual ~TestInputNodeListener() = default; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc); + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc); - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId); + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId); }; class TestSimulationEventListenerStub : public diff --git a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp index 2a8cef2..8cd452c 100644 --- a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp +++ b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.cpp @@ -74,13 +74,13 @@ void DistributedInputSinkManagerTest::TestGetSinkScreenInfosCb::OnResult(const s (void)strJson; } -int32_t DistributedInputSinkManagerTest::TestSharingDhIdListenerStub::OnSharing(std::string dhId) +int32_t DistributedInputSinkManagerTest::TestSharingDhIdListenerStub::OnSharing(const std::string &dhId) { (void)dhId; return DH_SUCCESS; } -int32_t DistributedInputSinkManagerTest::TestSharingDhIdListenerStub::OnNoSharing(std::string dhId) +int32_t DistributedInputSinkManagerTest::TestSharingDhIdListenerStub::OnNoSharing(const std::string &dhId) { (void)dhId; return DH_SUCCESS; diff --git a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h index 4abf048..faffb0a 100644 --- a/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h +++ b/services/sink/sinkmanager/test/sinkmanagerunittest/distributed_input_sinkmanager_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -52,8 +52,8 @@ public: public: TestSharingDhIdListenerStub() = default; virtual ~TestSharingDhIdListenerStub() = default; - int32_t OnSharing(std::string dhId) override; - int32_t OnNoSharing(std::string dhId) override; + int32_t OnSharing(const std::string &dhId) override; + int32_t OnNoSharing(const std::string &dhId) override; }; private: DistributedInputSinkManager* sinkManager_; diff --git a/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.cpp b/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.cpp index 9a0b741..82fa6ff 100644 --- a/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.cpp +++ b/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.cpp @@ -51,8 +51,8 @@ void DistributedInputSourceInjectTest::TearDownTestCase() { } -void DistributedInputSourceInjectTest::TestInputNodeListener::OnNodeOnLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) +void DistributedInputSourceInjectTest::TestInputNodeListener::OnNodeOnLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc) { (void)srcDevId; (void)sinkDevId; @@ -60,8 +60,8 @@ void DistributedInputSourceInjectTest::TestInputNodeListener::OnNodeOnLine(const (void)sinkNodeDesc; } -void DistributedInputSourceInjectTest::TestInputNodeListener::OnNodeOffLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId) +void DistributedInputSourceInjectTest::TestInputNodeListener::OnNodeOffLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId) { (void)srcDevId; (void)sinkDevId; diff --git a/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.h b/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.h index c97fab4..6d76e57 100644 --- a/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.h +++ b/services/source/inputinject/test/sourceinjectunittest/distributed_input_sourceinject_test.h @@ -42,9 +42,9 @@ public: public: TestInputNodeListener() = default; virtual ~TestInputNodeListener() = default; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, const std::string sinkNodeId, - const std::string sinkNodeDesc); - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, const std::string sinkNodeId); + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, const std::string &sinkNodeId, + const std::string &sinkNodeDesc); + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, const std::string &sinkNodeId); }; class TestRegisterSessionStateCallbackStub : diff --git a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp index 390e3fe..a013204 100644 --- a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp +++ b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.cpp @@ -164,8 +164,8 @@ void DistributedInputSourceManagerTest::TestStartStopResultCb::OnStop(const std: return; } -void DistributedInputSourceManagerTest::TestInputNodeListenerCb::OnNodeOnLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId, const std::string sinkNodeDesc) +void DistributedInputSourceManagerTest::TestInputNodeListenerCb::OnNodeOnLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId, const std::string &sinkNodeDesc) { (void)srcDevId; (void)sinkDevId; @@ -174,8 +174,8 @@ void DistributedInputSourceManagerTest::TestInputNodeListenerCb::OnNodeOnLine(co return; } -void DistributedInputSourceManagerTest::TestInputNodeListenerCb::OnNodeOffLine(const std::string srcDevId, - const std::string sinkDevId, const std::string sinkNodeId) +void DistributedInputSourceManagerTest::TestInputNodeListenerCb::OnNodeOffLine(const std::string &srcDevId, + const std::string &sinkDevId, const std::string &sinkNodeId) { (void)srcDevId; (void)sinkDevId; diff --git a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h index c47d5e0..1a757ed 100644 --- a/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h +++ b/services/source/sourcemanager/test/sourcemanagerunittest/distributed_input_sourcemanager_test.h @@ -1,5 +1,5 @@ /* - * Copyright (c) 2021-2023 Huawei Device Co., Ltd. + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at @@ -131,11 +131,11 @@ public: public: TestInputNodeListenerCb() = default; virtual ~TestInputNodeListenerCb() = default; - void OnNodeOnLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId, const std::string sinkNodeDesc); + void OnNodeOnLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId, const std::string &sinkNodeDesc); - void OnNodeOffLine(const std::string srcDevId, const std::string sinkDevId, - const std::string sinkNodeId); + void OnNodeOffLine(const std::string &srcDevId, const std::string &sinkDevId, + const std::string &sinkNodeId); }; class TestSimulationEventCb : public OHOS::DistributedHardware::DistributedInput::SimulationEventListenerStub { -- Gitee