diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp index 1a7a14a093d088685e72382d77d515ce462807c4..6580f1090c6be8d70a44690f2960da8c013719b7 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/change_notification.cpp @@ -151,8 +151,12 @@ ChangeNotification *ChangeNotification::Unmarshalling(Parcel &parcel) std::string deviceId = parcel.ReadString(); bool isClear = parcel.ReadBool(); - return new ChangeNotification(std::move(insertEntries), std::move(updateEntries), std::move(deleteEntries), - deviceId, isClear); + auto result = new(std::nothrow) ChangeNotification(std::move(insertEntries), std::move(updateEntries), + std::move(deleteEntries), deviceId, isClear); + if (result == nullptr) { + return nullptr + } + return result; } } // namespace DistributedKv } // namespace OHOS diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/delegate_mgr_callback.h b/frameworks/innerkitsimpl/distributeddatafwk/src/delegate_mgr_callback.h index 88fa29abde12ea461302cc4ee9fc0022bbe1cf80..02c28f3e5b70381c421d54c9df9a75bdcd12bb68 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/delegate_mgr_callback.h +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/delegate_mgr_callback.h @@ -32,11 +32,7 @@ public: if (IsDestruct()) { return false; } - DistributedDB::DBStatus ret = delegate_->GetKvStoreDiskSize(storeId, size); - if (ret != DistributedDB::DBStatus::OK) { - return false; - } - return true; + return delegate_->GetKvStoreDiskSize(storeId, size) == DistributedDB::DBStatus::OK; } void GetKvStoreKeys(std::vector &entries) override diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore.cpp index 809af1dec1958c3a9663fe86f53fd86cf18dca04..f37316e8a36ec0b80a9c2710f3969a06b6f7afb6 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/ikvstore.cpp @@ -139,7 +139,8 @@ Status KvStoreImplProxy::Put(const Key &key, const Value &value) return static_cast(reply.ReadInt32()); } ZLOGI("putting large data."); - std::unique_ptr buffer(new uint8_t[bufferSize], [](uint8_t *ptr) { delete[] ptr; }); + std::unique_ptr buffer(new(std::nothrow) uint8_t[bufferSize], [](uint8_t *ptr) + { delete[] ptr; }); if (buffer == nullptr) { ZLOGW("buffer is null"); return Status::ERROR; diff --git a/frameworks/jskitsimpl/distributeddata/src/js_query.cpp b/frameworks/jskitsimpl/distributeddata/src/js_query.cpp index 4b55d0ef928d2501ab4f3a84f508a5ad1a8730a5..2abc634ade44ce6a23049eef5295801ba3929725 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_query.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_query.cpp @@ -286,7 +286,6 @@ napi_value JsQuery::IsNull(napi_env env, napi_callback_info info) /* * InNumber / NotInNumber * [NOTES] Recommended to use the napi_typedarray_type - * https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects#indexed_collections */ enum class NumberType : uint8_t { NUMBER_INT, diff --git a/test/resource/distributeddataservice/config/trans_permission.json b/test/resource/distributeddataservice/config/trans_permission.json deleted file mode 100755 index fd9b0dcd57fb0faf1c5b491c99583baf83a19185..0000000000000000000000000000000000000000 --- a/test/resource/distributeddataservice/config/trans_permission.json +++ /dev/null @@ -1,130 +0,0 @@ -[ - { - "SESSION_NAME": "ohos\\.distributedschedule\\.foundation.*", - "REGEXP": "true", - "DEVID": "UUID", - "APP_INFO": [ - { - "TYPE": "system_app", - "UID": "1000", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "com\\.huawei\\.def.*", - "REGEXP": "true", - "DEVID": "NETWORKID", - "APP_INFO": [ - { - "TYPE": "system_app", - "UID": "1000", - "PKG_NAME": "com.huawei.def", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "com\\.huawei\\.hwddmp.*", - "REGEXP": "true", - "DEVID": "UUID", - "APP_INFO": [ - { - "TYPE": "system_app", - "UID": "1000", - "PKG_NAME": "com.huawei.hwddmp", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "com.huawei.devicegroupmanage", - "DEVID": "UDID", - "APP_INFO": [ - { - "TYPE": "system_app", - "PKG_NAME": "com.huawei.devicegroupmanage", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "DBinderService", - "DEVID": "NETWORKID", - "APP_INFO": [ - { - "TYPE": "native_app", - "UID": "1000", - "PKG_NAME": "DBinderService", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "DBinder.*", - "REGEXP": "true", - "DEVID": "NETWORKID", - "SEC_LEVEL": "public", - "APP_INFO": [ - { - "TYPE": "granted_app", - "PKG_NAME": "DBinderBus", - "ACTIONS": "open" - } - ] - }, - { - "SESSION_NAME": "distributeddata.*", - "REGEXP": "true", - "DEVID": "UUID", - "APP_INFO": [ - { - "TYPE": "system_app", - "UID": "1000", - "PKG_NAME": "com.huawei.hwddmp", - "ACTIONS": "create,open" - }, - { - "TYPE": "system_app", - "UID": "0", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "SystemAbilityManager_DDC.*", - "REGEXP": "true", - "DEVID": "UUID", - "APP_INFO": [ - { - "TYPE": "native_app", - "UID": "1000", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "hiview_distributed_network_softbus", - "DEVID": "NETWORKID", - "APP_INFO": [ - { - "TYPE": "native_app", - "UID": "0", - "PKG_NAME": "hiview_distributed_network_softbus", - "ACTIONS": "create,open" - } - ] - }, - { - "SESSION_NAME": "DistributedFileService.*", - "REGEXP": "true", - "DEVID": "UUID", - "APP_INFO": [ - { - "TYPE": "native_app", - "UID": "1000", - "ACTIONS": "create,open" - } - ] - } -] \ No newline at end of file diff --git a/test/resource/distributeddataservice/ohos_test.xml b/test/resource/distributeddataservice/ohos_test.xml deleted file mode 100755 index e89ac8c4221389616e3397e1c0b673c0f2425718..0000000000000000000000000000000000000000 --- a/test/resource/distributeddataservice/ohos_test.xml +++ /dev/null @@ -1,22 +0,0 @@ - - - - - - - -