fix bug and codeCheck

Signed-off-by: 1529367376@qq.com <wanghuajian3@huawei.com>
This commit is contained in:
1529367376@qq.com 2023-12-10 15:06:12 +08:00
parent 66bd1579aa
commit 8915c3f890
15 changed files with 16 additions and 25 deletions

View File

@ -130,9 +130,9 @@
"metadata/strategy_meta_data.h",
"metadata/user_meta_data.h",
"serializable/serializable.h",
"snapshot/bind_event.h",
"snapshot/machine_status.h",
"snapshot/snapshot.h",
"snapshot/bind_event.h",
"store/auto_cache.h",
"store/cursor.h",
"store/general_store.h",

View File

@ -74,8 +74,8 @@ ohos_shared_library("distributeddatasvcfwk") {
"metadata/strategy_meta_data.cpp",
"metadata/user_meta_data.cpp",
"serializable/serializable.cpp",
"snapshot/snapshot.cpp",
"snapshot/bind_event.cpp",
"snapshot/snapshot.cpp",
"store/auto_cache.cpp",
"utils/anonymous.cpp",
"utils/block_integer.cpp",

View File

@ -60,4 +60,4 @@ struct StoreInfo {
};
} // namespace DistributedData
} // namespace OHOS
#endif //OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_SNAPSHOT_MACHINE_STATUS_H
#endif // OHOS_DISTRIBUTED_DATA_SERVICES_FRAMEWORK_SNAPSHOT_MACHINE_STATUS_H

View File

@ -24,5 +24,4 @@ const BindEvent::BindEventInfo& BindEvent::GetBindInfo() const
{
return bindInfo_;
}
} // namespace OHOS::DistributedData

View File

@ -58,5 +58,4 @@ bool Snapshot::IsBoundAsset(const Asset& asset)
{
return false;
}
} // namespace OHOS::DistributedData

View File

@ -94,13 +94,13 @@ ohos_shared_library("distributeddatasvc") {
"matrix/src/device_matrix.cpp",
"matrix/src/matrix_event.cpp",
"object/object_asset_loader.cpp",
"object/object_asset_machine.cpp",
"object/object_callback_proxy.cpp",
"object/object_data_listener.cpp",
"object/object_manager.cpp",
"object/object_service_impl.cpp",
"object/object_service_stub.cpp",
"object/object_snapshot.cpp",
"object/object_asset_machine.cpp",
"object/object_types_utils.cpp",
"permission/src/permit_delegate.cpp",
"rdb/cache_cursor.cpp",

View File

@ -63,7 +63,7 @@ bool ObjectAssetLoader::DownLoad(const int32_t userId, const std::string& bundle
assetInfo.uri = assetValue.uri;
assetInfo.assetName = assetValue.name;
CloudSyncAssetManager::GetInstance().DownloadFile(userId, bundleName, deviceId, assetInfo,
[&](const std::string& uri, int32_t status) {
[callback](const std::string& uri, int32_t status) {
status == 0 ? callback(true) : callback(false);
});
return true;

View File

@ -136,11 +136,8 @@ int32_t ObjectAssetMachine::DFAPostEvent(AssetEvent eventId, TransferStatus& sta
}
}
if (action->next != STATUS_NO_CHANGE) {
ZLOGI("status before:%{public}d", status);
ZLOGI("status before:%{public}d, eventId: %{public}d, status after:%{public}d", status, eventId, action->next);
status = static_cast<TransferStatus>(action->next);
ZLOGI("eventId: %{public}d, status after:%{public}d", eventId, status);
} else {
ZLOGI("status nochange: %{public}d", status);
}
if (action->after != nullptr) {
int32_t res = action->after(eventId, param, param2);

View File

@ -737,7 +737,7 @@ int32_t ObjectStoreManager::BindAsset(const uint32_t tokenId, const std::string&
HapTokenInfo tokenInfo;
auto status = AccessTokenKit::GetHapTokenInfo(tokenId, tokenInfo);
if (status != RET_SUCCESS) {
ZLOGE("token:0x%{public}x, result:%{public}d", tokenId, status);
ZLOGE("token:0x%{public}x, result:%{public}d, bundleName:%{public}s", tokenId, status, appId.c_str());
return GeneralError::E_ERROR;
}
StoreInfo storeInfo;
@ -778,8 +778,7 @@ int32_t ObjectStoreManager::OnAssetChanged(const uint32_t tokenId, const std::st
return OBJECT_SUCCESS;
} else {
ZLOGE("DownLoad fail, userId: %{public}d, bundleName: %{public}s, networkId: %{public}s, asset name : "
"%{public}s",
userId, appId.c_str(), deviceId.c_str(), asset.name.c_str());
"%{public}s", userId, appId.c_str(), deviceId.c_str(), asset.name.c_str());
return OBJECT_INNER_ERROR;
}
}

View File

@ -97,8 +97,6 @@ int32_t ObjectServiceImpl::OnAssetChanged(const std::string &bundleName, const s
int32_t ObjectServiceImpl::BindAssetStore(const std::string &bundleName, const std::string &sessionId,
ObjectStore::Asset &asset, ObjectStore::AssetBindInfo &bindInfo)
{
ZLOGD("begin.");
uint32_t tokenId = IPCSkeleton::GetCallingTokenID();
int32_t status = IsBundleNameEqualTokenId(bundleName, sessionId, tokenId);
if (status != OBJECT_SUCCESS) {
@ -106,7 +104,8 @@ int32_t ObjectServiceImpl::BindAssetStore(const std::string &bundleName, const s
}
status = ObjectStoreManager::GetInstance()->BindAsset(tokenId, bundleName, sessionId, asset, bindInfo);
if (status != OBJECT_SUCCESS) {
ZLOGE("bind asset fail %{public}d", status);
ZLOGE("bind asset fail %{public}d, bundleName:%{public}s, sessionId:%{public}s, assetName:%{public}s", status,
bundleName.c_str(), asset.name.c_str());
}
return status;
}
@ -236,7 +235,6 @@ int32_t ObjectServiceImpl::UnregisterDataChangeObserver(const std::string &bundl
int32_t ObjectServiceImpl::DeleteSnapshot(const std::string &bundleName, const std::string &sessionId)
{
ZLOGD("begin.");
uint32_t tokenId = IPCSkeleton::GetCallingTokenID();
int32_t status = IsBundleNameEqualTokenId(bundleName, sessionId, tokenId);
if (status != OBJECT_SUCCESS) {

View File

@ -25,5 +25,4 @@ template<>
bool Unmarshalling(AssetBindInfo &output, MessageParcel &data);
}
#endif //DISTRIBUTEDDATAMGR_OBJECT_TYPES_UTILS_H
#endif // DISTRIBUTEDDATAMGR_OBJECT_TYPES_UTILS_H

View File

@ -69,6 +69,7 @@ ohos_fuzztest("CloudServiceStubFuzzTest") {
"${data_service_path}/service/cloud/cloud_types_util.cpp",
"${data_service_path}/service/cloud/cloud_value_util.cpp",
"${data_service_path}/service/cloud/sync_manager.cpp",
"${data_service_path}/service/common/value_proxy.cpp",
"${data_service_path}/service/config/src/config_factory.cpp",
"${data_service_path}/service/config/src/model/backup_config.cpp",
"${data_service_path}/service/config/src/model/checker_config.cpp",
@ -91,7 +92,6 @@ ohos_fuzztest("CloudServiceStubFuzzTest") {
"${data_service_path}/service/rdb/rdb_service_impl.cpp",
"${data_service_path}/service/rdb/rdb_service_stub.cpp",
"${data_service_path}/service/rdb/rdb_watcher.cpp",
"${data_service_path}/service/common/value_proxy.cpp",
"cloudservicestub_fuzzer.cpp",
]

View File

@ -55,6 +55,7 @@ ohos_fuzztest("ObjectServiceStubFuzzTest") {
sources = [
"${data_service_path}/service/backup/src/backup_manager.cpp",
"${data_service_path}/service/bootstrap/src/bootstrap.cpp",
"${data_service_path}/service/common/value_proxy.cpp",
"${data_service_path}/service/config/src/config_factory.cpp",
"${data_service_path}/service/config/src/model/backup_config.cpp",
"${data_service_path}/service/config/src/model/checker_config.cpp",
@ -63,16 +64,15 @@ ohos_fuzztest("ObjectServiceStubFuzzTest") {
"${data_service_path}/service/config/src/model/global_config.cpp",
"${data_service_path}/service/config/src/model/network_config.cpp",
"${data_service_path}/service/config/src/model/protocol_config.cpp",
"${data_service_path}/service/common/value_proxy.cpp",
"${data_service_path}/service/crypto/src/crypto_manager.cpp",
"${data_service_path}/service/object/object_asset_loader.cpp",
"${data_service_path}/service/object/object_asset_machine.cpp",
"${data_service_path}/service/object/object_callback_proxy.cpp",
"${data_service_path}/service/object/object_data_listener.cpp",
"${data_service_path}/service/object/object_manager.cpp",
"${data_service_path}/service/object/object_service_impl.cpp",
"${data_service_path}/service/object/object_service_stub.cpp",
"${data_service_path}/service/object/object_snapshot.cpp",
"${data_service_path}/service/object/object_asset_machine.cpp",
"${data_service_path}/service/object/object_types_utils.cpp",
"objectservicestub_fuzzer.cpp",
]

View File

@ -50,9 +50,9 @@ ohos_fuzztest("RdbResultSetStubFuzzTest") {
]
sources = [
"${data_service_path}/service/common/value_proxy.cpp",
"${data_service_path}/service/rdb/rdb_result_set_impl.cpp",
"${data_service_path}/service/rdb/rdb_result_set_stub.cpp",
"${data_service_path}/service/common/value_proxy.cpp",
"rdbresultsetstub_fuzzer.cpp",
]

View File

@ -65,6 +65,7 @@ ohos_fuzztest("RdbServiceStubFuzzTest") {
"${data_service_path}/app/src/checker/system_checker.cpp",
"${data_service_path}/service/backup/src/backup_manager.cpp",
"${data_service_path}/service/bootstrap/src/bootstrap.cpp",
"${data_service_path}/service/common/value_proxy.cpp",
"${data_service_path}/service/config/src/config_factory.cpp",
"${data_service_path}/service/config/src/model/backup_config.cpp",
"${data_service_path}/service/config/src/model/checker_config.cpp",
@ -87,7 +88,6 @@ ohos_fuzztest("RdbServiceStubFuzzTest") {
"${data_service_path}/service/rdb/rdb_service_impl.cpp",
"${data_service_path}/service/rdb/rdb_service_stub.cpp",
"${data_service_path}/service/rdb/rdb_watcher.cpp",
"${data_service_path}/service/common/value_proxy.cpp",
"rdbservicestub_fuzzer.cpp",
]