diff --git a/interfaces/innerkits/core/src/distributed_device_profile_client.cpp b/interfaces/innerkits/core/src/distributed_device_profile_client.cpp index 4ecaa98..5c919b9 100755 --- a/interfaces/innerkits/core/src/distributed_device_profile_client.cpp +++ b/interfaces/innerkits/core/src/distributed_device_profile_client.cpp @@ -241,14 +241,12 @@ void DistributedDeviceProfileClient::MergeSubscribeInfoLocked(std::list remote = Remote(); MessageParcel data; if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) { - HILOGE("write inteface token failed"); + HILOGE("write interface token failed"); return ERR_FLATTEN_OBJECT; } PARCEL_WRITE_HELPER(data, String, serviceId); @@ -84,7 +84,7 @@ int32_t DistributedDeviceProfileProxy::SubscribeProfileEvents( sptr remote = Remote(); MessageParcel data; if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) { - HILOGE("write inteface token failed"); + HILOGE("write interface token failed"); return ERR_FLATTEN_OBJECT; } size_t size = subscribeInfos.size(); @@ -116,7 +116,7 @@ int32_t DistributedDeviceProfileProxy::UnsubscribeProfileEvents( sptr remote = Remote(); MessageParcel data; if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) { - HILOGE("write inteface token failed"); + HILOGE("write interface token failed"); return ERR_FLATTEN_OBJECT; } if (!DeviceProfileUtils::WriteProfileEvents(profileEvents, data)) { @@ -142,7 +142,7 @@ int32_t DistributedDeviceProfileProxy::SyncDeviceProfile(const SyncOptions& sync sptr remote = Remote(); MessageParcel data; if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) { - HILOGE("write inteface token failed"); + HILOGE("write interface token failed"); return ERR_FLATTEN_OBJECT; } diff --git a/interfaces/innerkits/core/src/profile_event_notifier_stub.cpp b/interfaces/innerkits/core/src/profile_event_notifier_stub.cpp index 700be80..95a9a6b 100755 --- a/interfaces/innerkits/core/src/profile_event_notifier_stub.cpp +++ b/interfaces/innerkits/core/src/profile_event_notifier_stub.cpp @@ -39,7 +39,7 @@ ProfileEventNotifierStub::HandlersMap ProfileEventNotifierStub::InitHandlersMap( int32_t ProfileEventNotifierStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { - HILOGI("code = %{public}d", code); + HILOGI("code = %{public}u", code); std::u16string descriptor = ProfileEventNotifierStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/services/core/src/authority/trust_group_manager.cpp b/services/core/src/authority/trust_group_manager.cpp index 9a07aae..9d3bc33 100644 --- a/services/core/src/authority/trust_group_manager.cpp +++ b/services/core/src/authority/trust_group_manager.cpp @@ -69,12 +69,12 @@ bool TrustGroupManager::CheckTrustGroup(const std::string& deviceId) int32_t ret = hichainGmInstance_->getRelatedGroups(ANY_OS_ACCOUNT, AUTH_APPID.c_str(), deviceId.c_str(), &returnGroups, &groupNum); if (ret != ERR_OK) { - HILOGE("faild , ret: %d", ret); + HILOGE("failed, ret:%{public}d", ret); return false; } if (returnGroups == nullptr || groupNum == 0) { - HILOGE("faild, returnGroups is nullptr"); + HILOGE("failed, returnGroups is nullptr"); return false; } diff --git a/services/core/src/dbstorage/sync_coordinator.cpp b/services/core/src/dbstorage/sync_coordinator.cpp index 129c3ae..067d9e6 100755 --- a/services/core/src/dbstorage/sync_coordinator.cpp +++ b/services/core/src/dbstorage/sync_coordinator.cpp @@ -40,7 +40,7 @@ bool SyncCoordinator::Init() bool SyncCoordinator::AcquireSync() { if (isOnSync_) { - HILOGI("acquire from %{publiic}s", isOnlineTrigger_ ? "online" : "manual"); + HILOGI("acquire from %{public}s", isOnlineTrigger_ ? "online" : "manual"); return false; } isOnSync_ = true; @@ -72,4 +72,4 @@ bool SyncCoordinator::DispatchSyncTask(const SyncTask& syncTask, int64_t delayTi return true; } } // namespace DeviceProfile -} // namespace OHOS \ No newline at end of file +} // namespace OHOS diff --git a/services/core/src/distributed_device_profile_stub.cpp b/services/core/src/distributed_device_profile_stub.cpp index 6158727..3ea0996 100755 --- a/services/core/src/distributed_device_profile_stub.cpp +++ b/services/core/src/distributed_device_profile_stub.cpp @@ -49,7 +49,7 @@ bool DistributedDeviceProfileStub::EnforceInterfaceToken(MessageParcel& data) int32_t DistributedDeviceProfileStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { - HILOGI("code = %{public}d, flags = %{public}d", code, option.GetFlags()); + HILOGI("code = %{public}u, flags = %{public}d", code, option.GetFlags()); auto iter = funcsMap_.find(code); if (iter != funcsMap_.end()) { diff --git a/services/core/src/subscribemanager/profile_change_handler.cpp b/services/core/src/subscribemanager/profile_change_handler.cpp index 72fc09a..2a8962e 100755 --- a/services/core/src/subscribemanager/profile_change_handler.cpp +++ b/services/core/src/subscribemanager/profile_change_handler.cpp @@ -57,6 +57,9 @@ std::unique_ptr ProfileKey::Parse(const std::string& entryKey) int32_t index = 0; auto profileKey = std::make_unique(); + if (profileKey == nullptr) { + return nullptr; + } profileKey->udid = std::move(vec[index++]); if (profileKey->udid.size() != DEVICE_ID_SIZE) { HILOGE("parse udid failed"); @@ -191,7 +194,7 @@ void ProfileChangeHandler::NotifyProfileChangedLocked(const ProfileChangeNotific for (auto index : indexes) { filteredEntries.emplace_back(profileEntries[index]); } - HILOGI("filtered with %{public}zu entrie(s)", size); + HILOGI("filtered with %{public}zu entries", size); bool isLocal = changeNotification.IsLocal(); std::string deviceId = changeNotification.GetDeviceId(); ProfileChangeNotification filteredNotification(filteredEntries, deviceId, isLocal); diff --git a/services/core/test/unittest/event_subscribe_test.cpp b/services/core/test/unittest/event_subscribe_test.cpp index c70d0e5..b75a70a 100755 --- a/services/core/test/unittest/event_subscribe_test.cpp +++ b/services/core/test/unittest/event_subscribe_test.cpp @@ -421,7 +421,7 @@ HWTEST_F(EventSubscribeTest, SubscribeWithUnsusbscribe002, TestSize.Level2) } /** - * @tc.steps: step4. put a other subscribed service profile + * @tc.steps: step4. put a subscribed service profile * @tc.expected: step4. can't receive notification. */ errCode = PutFakeStorage(); diff --git a/services/core/test/unittest/profile_authority_test.cpp b/services/core/test/unittest/profile_authority_test.cpp index 6e84557..6a1a32c 100644 --- a/services/core/test/unittest/profile_authority_test.cpp +++ b/services/core/test/unittest/profile_authority_test.cpp @@ -119,7 +119,7 @@ HWTEST_F(ProfileAuthorityTest, CheckAuthority_003, TestSize.Level0) /** * @tc.name: CheckAuthority_004 - * @tc.desc: check authority of a empty serviceId + * @tc.desc: check authority of an empty serviceId * @tc.type: FUNC */ HWTEST_F(ProfileAuthorityTest, CheckAuthority_004, TestSize.Level0) @@ -173,7 +173,7 @@ HWTEST_F(ProfileAuthorityTest, CheckAuthority_006, TestSize.Level0) /** * @tc.name: CheckAuthority_007 - * @tc.desc: check authority of mulitiple serviceIds + * @tc.desc: check authority of multiple serviceIds * @tc.type: FUNC */ HWTEST_F(ProfileAuthorityTest, CheckAuthority_007, TestSize.Level0) @@ -206,4 +206,4 @@ HWTEST_F(ProfileAuthorityTest, CheckAuthority_008, TestSize.Level0) EXPECT_FALSE(AuthorityManager::GetInstance().CheckInterfaceAuthority("")); } } -} \ No newline at end of file +} diff --git a/tools/dp/src/dp_command.cpp b/tools/dp/src/dp_command.cpp index ddb871e..fdb15c7 100755 --- a/tools/dp/src/dp_command.cpp +++ b/tools/dp/src/dp_command.cpp @@ -78,7 +78,7 @@ ErrCode DpShellCommand::HelpCommand() ErrCode DpShellCommand::GetDeviceCommand() { resultReceiver_.append("[remote device list]\n"); - NodeBasicInfo *info = NULL; + NodeBasicInfo *info = nullptr; int32_t infoNum = 0; int32_t ret = GetAllNodeDeviceInfo("dp", &info, &infoNum); if (ret != ERR_OK) {