From 3ac465953ef3a0040d4c2a3ea22758f2bb25f7da Mon Sep 17 00:00:00 2001 From: wanderer-dl122 Date: Tue, 20 Sep 2022 11:11:13 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9codecheck=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: wanderer-dl122 --- .../src/componentloader/component_loader.cpp | 8 ++++---- .../src/distributed_hardware_manager.cpp | 10 ---------- .../localhardwaremanager/local_hardware_manager.cpp | 2 +- .../src/resourcemanager/capability_info_manager.cpp | 3 +-- 4 files changed, 6 insertions(+), 17 deletions(-) diff --git a/services/distributedhardwarefwkservice/src/componentloader/component_loader.cpp b/services/distributedhardwarefwkservice/src/componentloader/component_loader.cpp index 1e323c7a..0ca61dfa 100644 --- a/services/distributedhardwarefwkservice/src/componentloader/component_loader.cpp +++ b/services/distributedhardwarefwkservice/src/componentloader/component_loader.cpp @@ -95,7 +95,7 @@ int32_t ComponentLoader::Init() std::vector ComponentLoader::GetAllCompTypes() { std::vector DHTypeALL; - for (std::map::iterator it = compHandlerMap_.begin(); it != compHandlerMap_.end(); it++) { + for (std::map::iterator it = compHandlerMap_.begin(); it != compHandlerMap_.end(); ++it) { DHTypeALL.push_back(it->first); } return DHTypeALL; @@ -137,7 +137,7 @@ int32_t ComponentLoader::GetCompPathAndVersion(const std::string &jsonStr, std:: std::vector vecJsnCfg = jsonCfg.at(COMPONENTSLOAD_DISTRIBUTED_COMPONENTS).get>(); DHLOGI("get distributed_components CompConfig size is %d", vecJsnCfg.size()); - for (std::vector::iterator iter = vecJsnCfg.begin(); iter != vecJsnCfg.end(); iter++) { + for (std::vector::iterator iter = vecJsnCfg.begin(); iter != vecJsnCfg.end(); ++iter) { dhtypeMap.insert(std::pair((*iter).type, (*iter))); localDHVersion_.compVersions.insert( std::pair((*iter).type, GetCompVersionFromComConfig(*iter))); @@ -194,7 +194,7 @@ void *ComponentLoader::GetHandler(const std::string &soName) void ComponentLoader::GetAllHandler(std::map &dhtypeMap) { std::map::iterator itor; - for (itor = dhtypeMap.begin(); itor != dhtypeMap.end(); itor++) { + for (itor = dhtypeMap.begin(); itor != dhtypeMap.end(); ++itor) { CompHandler comHandler; comHandler.type = itor->second.type; comHandler.hardwareHandler = GetHandler(itor->second.compHandlerLoc); @@ -335,7 +335,7 @@ int32_t ComponentLoader::UnInit() DHTraceStart(COMPONENT_RELEASE_START); int32_t ret = DH_FWK_SUCCESS; for (std::map::iterator iter = compHandlerMap_.begin(); - iter != compHandlerMap_.end(); iter++) { + iter != compHandlerMap_.end(); ++iter) { ret += ReleaseHardwareHandler(iter->first); ret += ReleaseSource(iter->first); ret += ReleaseSink(iter->first); diff --git a/services/distributedhardwarefwkservice/src/distributed_hardware_manager.cpp b/services/distributedhardwarefwkservice/src/distributed_hardware_manager.cpp index ff4cbc92..fbd9a416 100644 --- a/services/distributedhardwarefwkservice/src/distributed_hardware_manager.cpp +++ b/services/distributedhardwarefwkservice/src/distributed_hardware_manager.cpp @@ -38,16 +38,6 @@ namespace DistributedHardware { #undef DH_LOG_TAG #define DH_LOG_TAG "DistributedHardwareManager" -#ifdef __cplusplus -#define EXTERNC extern "C" -#else -#define EXTERNC -#endif - -EXTERNC __attribute__((visibility("default"))) IDistributedHardwareManager *GetDistributedHardwareManagerInstance() -{ - return &DistributedHardwareManager::GetInstance(); -} IMPLEMENT_SINGLE_INSTANCE(DistributedHardwareManager); diff --git a/services/distributedhardwarefwkservice/src/localhardwaremanager/local_hardware_manager.cpp b/services/distributedhardwarefwkservice/src/localhardwaremanager/local_hardware_manager.cpp index 547c206c..3ab0ae50 100644 --- a/services/distributedhardwarefwkservice/src/localhardwaremanager/local_hardware_manager.cpp +++ b/services/distributedhardwarefwkservice/src/localhardwaremanager/local_hardware_manager.cpp @@ -127,7 +127,7 @@ void LocalHardwareManager::CheckNonExistCapabilityInfo(const std::vector for (auto capabilityInfo : allLocalCapabilityInfos) { std::shared_ptr capabilityValue = capabilityInfo.second; if (capabilityValue == nullptr) { - DHLOGE("capabilityInfo value is nullptr, key: %s", capabilityValue->GetAnonymousKey().c_str()); + DHLOGE("capabilityInfo value is nullptr"); continue; } DHLOGI("The key in allLocalCapabilityInfos is %s", capabilityValue->GetAnonymousKey().c_str()); diff --git a/services/distributedhardwarefwkservice/src/resourcemanager/capability_info_manager.cpp b/services/distributedhardwarefwkservice/src/resourcemanager/capability_info_manager.cpp index cb39f613..faf56955 100644 --- a/services/distributedhardwarefwkservice/src/resourcemanager/capability_info_manager.cpp +++ b/services/distributedhardwarefwkservice/src/resourcemanager/capability_info_manager.cpp @@ -266,9 +266,8 @@ std::map> CapabilityInfoManager::Qu { std::lock_guard lock(capInfoMgrMutex_); std::map> capMap; - bool isMatch = true; for (auto &info : globalCapInfoMap_) { - isMatch = true; + bool isMatch = true; for (auto &filter : filters) { if (!IsCapabilityMatchFilter(info.second, filter.first, filter.second)) { isMatch = false; -- Gitee