diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp index 0ebbe34a14ca20f9f59494fef29e997fdecaece0..8de7e7424c4c3c21ff86aa3596c2b159fbe4722d 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_stub.cpp @@ -15,8 +15,6 @@ #include "distributed_hardware_stub.h" -#include - #include "anonymous_string.h" #include "constants.h" #include "distributed_hardware_errno.h" diff --git a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h index c1f937dc7f10fe620c58984bb61a728a426c66c8..cc7ff2fbe2450e66109a968f45b9482bb1f53ef7 100644 --- a/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h +++ b/services/distributedhardwarefwkserviceimpl/include/resourcemanager/db_adapter.h @@ -24,9 +24,9 @@ #include #include "distributed_kv_data_manager.h" +#include "kvstore_observer.h" #include "capability_info.h" -#include "capability_info_manager.h" #include "event_sender.h" namespace OHOS { diff --git a/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h b/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h index 18d06c346dd762bc7ee82ac3a2b5a58810f8b394..cfcd34a45f9c1d0e007b8f28da5a92dbab37fc98 100644 --- a/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h +++ b/services/distributedhardwarefwkserviceimpl/include/task/offline_task.h @@ -17,7 +17,6 @@ #define OHOS_DISTRIBUTED_HARDWARE_OFFLINE_TASK_H #include -#include #include "task.h" diff --git a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp index 4f9f756b145ef6dcc97bc54cac88ba6b72bbfc2f..008cec9cb6a7bed91d58e38b4d9f46404b62bec7 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_disable.cpp @@ -15,8 +15,6 @@ #include "component_disable.h" -#include - #include "anonymous_string.h" #include "constants.h" #include "distributed_hardware_errno.h" diff --git a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp index d86e590de31231e774a121f5cdb99846dbb7d0d4..051bf0099e545c58a7f2bcac25b94ce4d9ef08f0 100644 --- a/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/componentmanager/component_enable.cpp @@ -15,8 +15,6 @@ #include "component_enable.h" -#include - #include "anonymous_string.h" #include "constants.h" #include "distributed_hardware_errno.h" diff --git a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp index d3e6e9d83f2016819c099424adaf37528d1f125d..bfe9077f136934c558a7da12d7cedf31092ed345 100644 --- a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_info_manager.cpp @@ -15,11 +15,6 @@ #include "capability_info_manager.h" -#include -#include -#include -#include - #include "anonymous_string.h" #include "capability_info_event.h" #include "capability_utils.h" @@ -352,6 +347,10 @@ void CapabilityInfoManager::HandleCapabilityAddChange(const std::vectorGetAnonymousKey().c_str()); globalCapInfoMap_[keyString] = capPtr; std::string uuid = DHContext::GetInstance().GetUUIDByDeviceId(capPtr->GetDeviceId()); + if (uuid.empty()) { + DHLOGI("Find uuid failed and never enable"); + continue; + } std::string networkId = DHContext::GetInstance().GetNetworkIdByUUID(uuid); if (networkId.empty()) { DHLOGI("Find network failed and never enable, deviceId: %s", GetAnonyString(uuid).c_str()); diff --git a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp index cfca0b9389c007b14f01b26d1e525f6c90561676..c70f713a49e86d7cf1620d45e00a487ecb2a0e8e 100644 --- a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/capability_utils.cpp @@ -15,10 +15,6 @@ #include "capability_utils.h" -#include -#include -#include - #include "nlohmann/json.hpp" #include "capability_info.h" diff --git a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp index a44192bb1049f6faa73a8cee5b3396341f7a17c2..02e738e9ba5284a773a8889fc285964376c02d97 100644 --- a/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/resourcemanager/db_adapter.cpp @@ -15,11 +15,6 @@ #include "db_adapter.h" -#include -#include - -#include "kvstore_observer.h" - #include "anonymous_string.h" #include "capability_info.h" #include "capability_info_manager.h" diff --git a/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp b/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp index 4c21c324e8ce75ec5160286988ae59765474b709..cd120a763cf6b57212ae8dc221444f5bda4ed1fa 100644 --- a/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/src/task/enable_task.cpp @@ -15,9 +15,6 @@ #include "enable_task.h" -#include -#include - #include "anonymous_string.h" #include "component_manager.h" #include "distributed_hardware_errno.h" diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp index 35a54724c90b1dd98043710086534c43a7355426..363facb94e548a96c4d74f51ca0c610771ef4cf6 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_disable_task.cpp @@ -15,9 +15,6 @@ #include "mock_disable_task.h" -#include -#include - #include "distributed_hardware_errno.h" #include "distributed_hardware_log.h" diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp index dea92cc5ef97d1488727f453cbca631db46392c1..c7f826e39e04c010493287695c39d13ded1b10ae 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_enable_task.cpp @@ -15,9 +15,6 @@ #include "mock_enable_task.h" -#include -#include - #include "distributed_hardware_errno.h" namespace OHOS { diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp index db577a7fb281ba2cd15e424a0286709be9bf6114..d587696b66eb3ec325fa302519636b1fc213e43e 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_offline_task.cpp @@ -15,9 +15,6 @@ #include "mock_offline_task.h" -#include -#include - #include "distributed_hardware_log.h" #include "mock_task_factory.h" #include "task_executor.h" diff --git a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp index 815b00e4ede4a59211644340e23e0a2dee42c34a..3b2b6b2f6cff5b2593354f881c45c560b999d875 100644 --- a/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp +++ b/services/distributedhardwarefwkserviceimpl/test/unittest/common/task/src/mock_online_task.cpp @@ -15,9 +15,6 @@ #include "mock_online_task.h" -#include -#include - #include "distributed_hardware_log.h" #include "mock_task_factory.h" #include "task_executor.h" diff --git a/utils/src/anonymous_string.cpp b/utils/src/anonymous_string.cpp index 73d95332e0fc30d9fcf01c806e67bd7afe24f062..68597d7b40762cb68ce0ac498d3abb59e00f54cd 100644 --- a/utils/src/anonymous_string.cpp +++ b/utils/src/anonymous_string.cpp @@ -15,9 +15,6 @@ #include "anonymous_string.h" -#include -#include - #include "securec.h" namespace OHOS { @@ -56,8 +53,8 @@ std::string GetAnonyInt32(const int32_t value) std::string nullString(""); return nullString; } - int32_t length = strlen(tempBuffer); - for (int32_t i = 1; i <= length - 1; i++) { + size_t length = strlen(tempBuffer); + for (size_t i = 1; i <= length - 1; i++) { tempBuffer[i] = '*'; } if (length == 0x01) { diff --git a/utils/test/unittest/common/eventbus/event_bus_test.cpp b/utils/test/unittest/common/eventbus/event_bus_test.cpp index 876696197a549732846941c8be62a71a460a9071..30d7a8135f2079a2ac201218ed21f520c94d1668 100644 --- a/utils/test/unittest/common/eventbus/event_bus_test.cpp +++ b/utils/test/unittest/common/eventbus/event_bus_test.cpp @@ -19,6 +19,14 @@ using namespace testing::ext; namespace OHOS { namespace DistributedHardware { +namespace { + FakeObject *g_obj = nullptr; + FakeSender *g_sender = nullptr; + FakeListener *g_listener = nullptr; + std::shared_ptr g_regHandler = nullptr; + EventBus* g_eventBus = nullptr; +} + void EventbusTest::SetUpTestCase(void) { } diff --git a/utils/test/unittest/common/eventbus/event_bus_test.h b/utils/test/unittest/common/eventbus/event_bus_test.h index c57b4c8395c058ac61d71ba996aafa2f98761062..110bfbb8f4670dab9c7dda1c2d54860b6a912d48 100644 --- a/utils/test/unittest/common/eventbus/event_bus_test.h +++ b/utils/test/unittest/common/eventbus/event_bus_test.h @@ -98,12 +98,6 @@ public: void SetUp(); void TearDown(); }; - -static FakeObject *g_obj = nullptr; -static FakeSender *g_sender = nullptr; -static FakeListener *g_listener = nullptr; -static std::shared_ptr g_regHandler = nullptr; -static EventBus* g_eventBus = nullptr; } } #endif \ No newline at end of file