diff --git a/services/distributeddataservice/service/data_share/subscriber_managers/published_data_subscriber_manager.cpp b/services/distributeddataservice/service/data_share/subscriber_managers/published_data_subscriber_manager.cpp index 05d7affb59c086c51b128c34437e07bf33538485..daa94de55b946ac1d6be6bf133c37c6c7b8eb91d 100644 --- a/services/distributeddataservice/service/data_share/subscriber_managers/published_data_subscriber_manager.cpp +++ b/services/distributeddataservice/service/data_share/subscriber_managers/published_data_subscriber_manager.cpp @@ -84,7 +84,7 @@ void PublishedDataSubscriberManager::Delete(uint32_t callerTokenId, uint32_t cal int PublishedDataSubscriberManager::Disable(const PublishedDataKey &key, uint32_t firstCallerTokenId) { - auto result = + bool result = publishedDataCache_.ComputeIfPresent(key, [&firstCallerTokenId](const auto &key, std::vector &value) { for (auto it = value.begin(); it != value.end(); it++) { @@ -95,7 +95,7 @@ int PublishedDataSubscriberManager::Disable(const PublishedDataKey &key, uint32_ } return true; }); - if (result != E_OK) { + if (!result) { ZLOGE("disable failed, uri is %{public}s, bundleName is %{public}s, subscriberId is %{public}" PRId64, DistributedData::Anonymous::Change(key.key).c_str(), key.bundleName.c_str(), key.subscriberId); } @@ -104,7 +104,7 @@ int PublishedDataSubscriberManager::Disable(const PublishedDataKey &key, uint32_ int PublishedDataSubscriberManager::Enable(const PublishedDataKey &key, uint32_t firstCallerTokenId) { - auto result = + bool result = publishedDataCache_.ComputeIfPresent(key, [&firstCallerTokenId](const auto &key, std::vector &value) { for (auto it = value.begin(); it != value.end(); it++) { @@ -114,7 +114,7 @@ int PublishedDataSubscriberManager::Enable(const PublishedDataKey &key, uint32_t } return true; }); - if (result != E_OK) { + if (!result) { ZLOGE("enable failed, uri is %{public}s, bundleName is %{public}s, subscriberId is %{public}" PRId64, DistributedData::Anonymous::Change(key.key).c_str(), key.bundleName.c_str(), key.subscriberId); } diff --git a/services/distributeddataservice/service/data_share/subscriber_managers/rdb_subscriber_manager.cpp b/services/distributeddataservice/service/data_share/subscriber_managers/rdb_subscriber_manager.cpp index 4f91e060de0a4c937a25f2bf664f8f7ed6d30ad2..d5245715c5080a986b4f6ac1e9eccb8b32020df5 100644 --- a/services/distributeddataservice/service/data_share/subscriber_managers/rdb_subscriber_manager.cpp +++ b/services/distributeddataservice/service/data_share/subscriber_managers/rdb_subscriber_manager.cpp @@ -187,7 +187,7 @@ void RdbSubscriberManager::Delete(uint32_t callerTokenId, uint32_t callerPid) int RdbSubscriberManager::Disable(const Key &key, uint32_t firstCallerTokenId) { bool isAllDisabled = true; - auto result = + bool result = rdbCache_.ComputeIfPresent(key, [&firstCallerTokenId, &isAllDisabled, this](const auto &key, std::vector &value) { for (auto it = value.begin(); it != value.end(); it++) { @@ -204,7 +204,7 @@ int RdbSubscriberManager::Disable(const Key &key, uint32_t firstCallerTokenId) if (isAllDisabled) { SchedulerManager::GetInstance().Disable(key); } - if (result != E_OK) { + if (!result) { ZLOGE("disable failed, uri is %{public}s, bundleName is %{public}s, subscriberId is %{public}" PRId64, DistributedData::Anonymous::Change(key.uri).c_str(), key.bundleName.c_str(), key.subscriberId); } @@ -215,7 +215,7 @@ int RdbSubscriberManager::Enable(const Key &key, std::shared_ptr contex { bool isChanged = false; DistributedData::StoreMetaData metaData; - auto result = rdbCache_.ComputeIfPresent(key, [&context, &metaData, &isChanged, this](const auto &key, + bool result = rdbCache_.ComputeIfPresent(key, [&context, &metaData, &isChanged, this](const auto &key, std::vector &value) { for (auto it = value.begin(); it != value.end(); it++) { if (it->firstCallerTokenId != context->callerTokenId) { @@ -239,7 +239,7 @@ int RdbSubscriberManager::Enable(const Key &key, std::shared_ptr contex if (isChanged) { SchedulerManager::GetInstance().Enable(key, context->visitedUserId, metaData); } - if (result != E_OK) { + if (!result) { ZLOGE("enable failed, uri is %{public}s, bundleName is %{public}s, subscriberId is %{public}" PRId64, DistributedData::Anonymous::Change(key.uri).c_str(), key.bundleName.c_str(), key.subscriberId); }