From 96ae9c7c4c82d7656e39e947537f0f8f2fcfff50 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Mon, 21 Mar 2022 18:57:33 +0800 Subject: [PATCH 1/4] Signed-off-by: wufengshan Changes to be committed: --- .../distributeddatafwk/src/ikvstore_resultset.cpp | 2 +- .../innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp | 2 +- .../test/unittest/app_distributed_kv_store_test.cpp | 5 +++-- .../adapter/account/test/account_delegate_test.cpp | 3 +++ .../adapter/communicator/src/process_communicator_impl.cpp | 1 + .../adapter/dfx/src/hiview_adapter.cpp | 1 + .../adapter/permission/src/client_permission_validator.cpp | 5 +++-- .../app/test/unittest/ut_kvstore_nb_delegate_impl.cpp | 2 ++ .../service/directory/src/directory_manager.cpp | 1 + .../distributeddataservice/service/rdb/rdb_service_stub.cpp | 2 +- 10 files changed, 17 insertions(+), 7 deletions(-) diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp index 72dd7171e..920781a0c 100755 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_resultset.cpp @@ -317,7 +317,7 @@ int KvStoreResultSetStub::OnRemoteRequest(uint32_t code, MessageParcel &data, Me return GetEntryOnRemote(reply); } default: { - ZLOGW("OnRemoteRequest default %d", code); + ZLOGW("OnRemoteRequest default %u", code); MessageOption mo { MessageOption::TF_SYNC }; return IPCObjectStub::OnRemoteRequest(code, data, reply, mo); } diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp index 396b2eae5..c606003b8 100755 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore_single.cpp @@ -1626,7 +1626,7 @@ int SingleKvStoreStub::OnSyncRequest(MessageParcel &data, MessageParcel &reply) int SingleKvStoreStub::OnRemoteRequest(uint32_t code, MessageParcel &data, MessageParcel &reply, MessageOption &option) { - ZLOGD("%{public}d", code); + ZLOGD("%{public}u", code); std::u16string descriptor = SingleKvStoreStub::GetDescriptor(); std::u16string remoteDescriptor = data.ReadInterfaceToken(); if (descriptor != remoteDescriptor) { diff --git a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp index 36091ec71..b97c2890e 100755 --- a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp @@ -1096,10 +1096,11 @@ HWTEST_F(AppDistributedKvStoreTest, AppKvstoreSubscribeKvStore001, TestSize.Leve }); EXPECT_NE(appKvStorePtr, nullptr); EXPECT_EQ(status, Status::SUCCESS); - ObserverImpl *observerLocal = new ObserverImpl(); + ObserverImpl *observerLocal = new (std::nothrow) ObserverImpl(); status = appKvStorePtr->SubscribeKvStore(localRead, subscribeType, observerLocal); EXPECT_EQ(status, Status::SUCCESS); - ObserverImpl *observerSync = new ObserverImpl(); + ObserverImpl *observerSync = new (std::nothrow) ObserverImpl(); + ASSERT_NE(observerSync,nullptr); status = appKvStorePtr->SubscribeKvStore(syncRead, subscribeType, observerSync); EXPECT_EQ(status, Status::SUCCESS); diff --git a/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp b/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp index 065543345..f2502839a 100755 --- a/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp +++ b/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp @@ -46,6 +46,9 @@ HWTEST_F(AccountDelegateTest, Test001, TestSize.Level0) { ZLOGD("start:"); auto account = AccountDelegate::GetInstance(); + if (account == nullotr) { + ZLOGD("account invalid"); + } auto observer = std::make_shared(); ZLOGD("observer:"); account->Subscribe(observer); diff --git a/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp b/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp index 8631d985f..e3c94be6a 100755 --- a/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp +++ b/services/distributeddataservice/adapter/communicator/src/process_communicator_impl.cpp @@ -141,6 +141,7 @@ uint32_t ProcessCommunicatorImpl::GetMtuSize(const DeviceInfos &devInfo) } return MTU_SIZE; } + DeviceInfos ProcessCommunicatorImpl::GetLocalDeviceInfos() { DeviceInfos localDevInfos; diff --git a/services/distributeddataservice/adapter/dfx/src/hiview_adapter.cpp b/services/distributeddataservice/adapter/dfx/src/hiview_adapter.cpp index 39e22568e..606578005 100755 --- a/services/distributeddataservice/adapter/dfx/src/hiview_adapter.cpp +++ b/services/distributeddataservice/adapter/dfx/src/hiview_adapter.cpp @@ -87,6 +87,7 @@ void HiViewAdapter::ReportDbSize(const StatisticWrap &stat) OHOS::HiviewDFX::HiSysEvent::EventType::FAULT, USER_ID, userId, APP_ID, stat.val.appId, STORE_ID, stat.val.storeId, DB_SIZE, dbSize); } + void HiViewAdapter::InvokeDbSize() { std::lock_guard lock(dbMutex_); diff --git a/services/distributeddataservice/adapter/permission/src/client_permission_validator.cpp b/services/distributeddataservice/adapter/permission/src/client_permission_validator.cpp index 6781b1b16..7707f3c25 100755 --- a/services/distributeddataservice/adapter/permission/src/client_permission_validator.cpp +++ b/services/distributeddataservice/adapter/permission/src/client_permission_validator.cpp @@ -34,7 +34,7 @@ std::int32_t ClientPermissionChangedCallback::GetPid() void ClientPermissionChangedCallback::OnChanged(const int32_t uid) { - + (void) uid; } void ClientPermissionValidator::UpdatePermissionStatus( @@ -48,6 +48,7 @@ void ClientPermissionValidator::UpdatePermissionStatus( bool ClientPermissionValidator::CheckClientSyncPermission(const KvStoreTuple &kvStoreTuple, std::int32_t curUid) { + (void) curUid; return true; } @@ -59,7 +60,7 @@ bool ClientPermissionValidator::RegisterPermissionChanged( void ClientPermissionValidator::UnregisterPermissionChanged(const KvStoreTuple &kvStoreTuple) { - + (void) kvStoreTuple; } // after the BMS service restarted, rebuild BundleManager object and re-register permission callbacks for all apps. diff --git a/services/distributeddataservice/app/test/unittest/ut_kvstore_nb_delegate_impl.cpp b/services/distributeddataservice/app/test/unittest/ut_kvstore_nb_delegate_impl.cpp index 745e24f35..0edc2717c 100755 --- a/services/distributeddataservice/app/test/unittest/ut_kvstore_nb_delegate_impl.cpp +++ b/services/distributeddataservice/app/test/unittest/ut_kvstore_nb_delegate_impl.cpp @@ -106,6 +106,7 @@ DBStatus UtKvStoreNbDelegateImpl::DoPut(const Key &key, const DbValue &dbValue) DBStatus UtKvStoreNbDelegateImpl::PutBatch(const std::vector &entries) { + (void) entries; return NOT_SUPPORT; } @@ -163,6 +164,7 @@ DBStatus UtKvStoreNbDelegateImpl::GetLocal(const Key &key, Value &value) const DBStatus UtKvStoreNbDelegateImpl::PutLocal(const Key &key, const Value &value) { + (void) key; return OK; } diff --git a/services/distributeddataservice/service/directory/src/directory_manager.cpp b/services/distributeddataservice/service/directory/src/directory_manager.cpp index f4e8f331c..63dd79fc7 100644 --- a/services/distributeddataservice/service/directory/src/directory_manager.cpp +++ b/services/distributeddataservice/service/directory/src/directory_manager.cpp @@ -94,6 +94,7 @@ std::string ClientDirWorker::GetSecretKeyDir(ClientContext clientContext, PathTy std::string DirectoryManager::CreatePath(const ClientContext &context, PathType type) { + (void) type; return ""; } diff --git a/services/distributeddataservice/service/rdb/rdb_service_stub.cpp b/services/distributeddataservice/service/rdb/rdb_service_stub.cpp index 1de876eea..6124fec64 100644 --- a/services/distributeddataservice/service/rdb/rdb_service_stub.cpp +++ b/services/distributeddataservice/service/rdb/rdb_service_stub.cpp @@ -180,7 +180,7 @@ bool RdbServiceStub::CheckInterfaceToken(MessageParcel& data) int RdbServiceStub::OnRemoteRequest(uint32_t code, MessageParcel& data, MessageParcel& reply, MessageOption& option) { - ZLOGI("code=%{public}d", code); + ZLOGI("code=%{public}u", code); if (!CheckInterfaceToken(data)) { return RDB_ERROR; } -- Gitee From cf864ef596669cecb9aa456cf14395c9d03c26b8 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Mon, 21 Mar 2022 19:00:11 +0800 Subject: [PATCH 2/4] Signed-off-by: wufengshan Changes to be committed: --- frameworks/jskitsimpl/distributeddata/src/uv_queue.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/frameworks/jskitsimpl/distributeddata/src/uv_queue.cpp b/frameworks/jskitsimpl/distributeddata/src/uv_queue.cpp index 8a58d08c0..763ca99f1 100644 --- a/frameworks/jskitsimpl/distributeddata/src/uv_queue.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/uv_queue.cpp @@ -70,7 +70,7 @@ void UvQueue::AsyncCall(NapiCallbackGetter getter, NapiArgsGenerator genArgs) napi_value result; napi_status status = napi_call_function(entry->env, global, method, argc, argv, &result); if (status != napi_ok) { - ZLOGE("notify data change failed status:%{public}d callback:%{public}p", status, method); + ZLOGE("notify data change failed status:%{public}d.", status); } }); } -- Gitee From 95848978807710ee61393adf3f26b27e4a807079 Mon Sep 17 00:00:00 2001 From: wufengshan Date: Mon, 21 Mar 2022 19:06:34 +0800 Subject: [PATCH 3/4] Signed-off-by: wufengshan Your branch is up to date with 'origin/master'. --- .../test/unittest/app_distributed_kv_store_test.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp index b97c2890e..5f0f35f29 100755 --- a/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/test/unittest/app_distributed_kv_store_test.cpp @@ -1096,11 +1096,14 @@ HWTEST_F(AppDistributedKvStoreTest, AppKvstoreSubscribeKvStore001, TestSize.Leve }); EXPECT_NE(appKvStorePtr, nullptr); EXPECT_EQ(status, Status::SUCCESS); + ObserverImpl *observerLocal = new (std::nothrow) ObserverImpl(); + EXPECT_NE(observerLocal, nullptr); status = appKvStorePtr->SubscribeKvStore(localRead, subscribeType, observerLocal); EXPECT_EQ(status, Status::SUCCESS); + ObserverImpl *observerSync = new (std::nothrow) ObserverImpl(); - ASSERT_NE(observerSync,nullptr); + EXPECT_NE(observerSync, nullptr); status = appKvStorePtr->SubscribeKvStore(syncRead, subscribeType, observerSync); EXPECT_EQ(status, Status::SUCCESS); -- Gitee From 5527f37c766f9fd3bb2842cffc984ed95a46070e Mon Sep 17 00:00:00 2001 From: wufengshan Date: Mon, 21 Mar 2022 19:10:46 +0800 Subject: [PATCH 4/4] Signed-off-by: wufengshan Changes to be committed: --- .../adapter/account/test/account_delegate_test.cpp | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp b/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp index f2502839a..14cfcf89f 100755 --- a/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp +++ b/services/distributeddataservice/adapter/account/test/account_delegate_test.cpp @@ -46,9 +46,7 @@ HWTEST_F(AccountDelegateTest, Test001, TestSize.Level0) { ZLOGD("start:"); auto account = AccountDelegate::GetInstance(); - if (account == nullotr) { - ZLOGD("account invalid"); - } + EXPECT_NE(account, nullptr); auto observer = std::make_shared(); ZLOGD("observer:"); account->Subscribe(observer); -- Gitee