!49 fix code review problems

Merge pull request !49 from Gymee/code_review
This commit is contained in:
openharmony_ci
2022-03-08 13:59:27 +00:00
committed by Gitee
7 changed files with 13 additions and 10 deletions
@@ -68,7 +68,7 @@ int32_t DistributedDeviceProfileProxy::DeleteDeviceProfile(const std::string& se
sptr<IRemoteObject> 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<IRemoteObject> 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<IRemoteObject> 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<IRemoteObject> remote = Remote();
MessageParcel data;
if (!data.WriteInterfaceToken(IDistributedDeviceProfile::GetDescriptor())) {
HILOGE("write inteface token failed");
HILOGE("write interface token failed");
return ERR_FLATTEN_OBJECT;
}
@@ -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) {
@@ -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;
}
@@ -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()) {
@@ -57,6 +57,9 @@ std::unique_ptr<ProfileKey> ProfileKey::Parse(const std::string& entryKey)
int32_t index = 0;
auto profileKey = std::make_unique<ProfileKey>();
if (profileKey == nullptr) {
return nullptr;
}
profileKey->udid = std::move(vec[index++]);
if (profileKey->udid.size() != DEVICE_ID_SIZE) {
HILOGE("parse udid failed");
@@ -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();
@@ -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)