diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp index 58894cf8a28e35c5fa2a182421565f8c2fa56e08..22c179f1cea91e8b7d31df8a20f573bbf40a0c91 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/distributed_kv_data_manager.cpp @@ -38,7 +38,7 @@ DistributedKvDataManager::~DistributedKvDataManager() Status DistributedKvDataManager::GetKvStore(const Options &options, const AppId &appId, const StoreId &storeId, std::shared_ptr &kvStore) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); kvStore = nullptr; std::string storeIdTmp = Constant::TrimCopy(storeId.storeId); @@ -81,7 +81,7 @@ Status DistributedKvDataManager::GetKvStore(const Options &options, const AppId Status DistributedKvDataManager::GetSingleKvStore(const Options &options, const AppId &appId, const StoreId &storeId, std::shared_ptr &singleKvStore) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); singleKvStore = nullptr; std::string storeIdTmp = Constant::TrimCopy(storeId.storeId); diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_client.cpp index 00192e53c3923d5a4197a8b9b6b2a5d05cda6220..70f80f154ccf9a2f6280e43d5fdb316db4bf06c1 100755 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_client.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_client.cpp @@ -44,7 +44,7 @@ StoreId KvStoreClient::GetStoreId() const Status KvStoreClient::GetKvStoreSnapshot(std::shared_ptr observer, std::shared_ptr &snapshot) const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); snapshot = nullptr; if (kvStoreProxy_ == nullptr) { @@ -102,7 +102,7 @@ Status KvStoreClient::ReleaseKvStoreSnapshot(std::shared_ptr &s Status KvStoreClient::Put(const Key &key, const Value &value) { ZLOGD("key: %zu value: %zu.", key.Size(), value.Size()); - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); std::vector keyData = Constant::TrimCopy>(key.Data()); if (keyData.size() == 0 || keyData.size() > Constant::MAX_KEY_LENGTH || @@ -121,7 +121,7 @@ Status KvStoreClient::Put(const Key &key, const Value &value) Status KvStoreClient::PutBatch(const std::vector &entries) { ZLOGI("entry size: %zu", entries.size()); - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (entries.size() > Constant::MAX_BATCH_SIZE) { ZLOGE("batch size must less than 128."); @@ -136,7 +136,7 @@ Status KvStoreClient::PutBatch(const std::vector &entries) Status KvStoreClient::Delete(const Key &key) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); std::vector keyData = Constant::TrimCopy>(key.Data()); if (keyData.size() == 0 || keyData.size() > Constant::MAX_KEY_LENGTH) { @@ -153,7 +153,7 @@ Status KvStoreClient::Delete(const Key &key) Status KvStoreClient::DeleteBatch(const std::vector &keys) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (keys.size() > Constant::MAX_BATCH_SIZE) { ZLOGE("batch size must less than 128."); @@ -191,7 +191,7 @@ Status KvStoreClient::StartTransaction() Status KvStoreClient::Commit() { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ != nullptr) { return kvStoreProxy_->Commit(); @@ -202,7 +202,7 @@ Status KvStoreClient::Commit() Status KvStoreClient::Rollback() { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ != nullptr) { return kvStoreProxy_->Rollback(); diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_resultset_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_resultset_client.cpp index 61c4707aae6649a81e11763409e11bae3c512f05..4c7d79546d7d8761de1fe339aa3c0195903a8e33 100755 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_resultset_client.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_resultset_client.cpp @@ -25,7 +25,7 @@ KvStoreResultSetClient::KvStoreResultSetClient(sptr kvStorePr int KvStoreResultSetClient::GetCount() const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); return kvStoreResultSetProxy_->GetCount(); } @@ -101,7 +101,7 @@ bool KvStoreResultSetClient::IsAfterLast() const Status KvStoreResultSetClient::GetEntry(Entry &entry) const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); return kvStoreResultSetProxy_->GetEntry(entry); } diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_snapshot_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_snapshot_client.cpp index b20d66156ef7e6cbff453538ca97f55685faa6f8..b346ac2b4ed7691d9ab5d3ea99762f43c32c8b3c 100644 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_snapshot_client.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/kvstore_snapshot_client.cpp @@ -38,7 +38,7 @@ KvStoreSnapshotClient::~KvStoreSnapshotClient() Status KvStoreSnapshotClient::GetEntries(const Key &prefixKey, Key &nextKey, std::vector &entries) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); std::vector keyData = Constant::TrimCopy>(prefixKey.Data()); if (keyData.size() > Constant::MAX_KEY_LENGTH) { @@ -66,7 +66,7 @@ Status KvStoreSnapshotClient::GetEntries(const Key &prefixKey, Key &nextKey, std Status KvStoreSnapshotClient::GetEntries(const Key &prefixKey, std::vector &entries) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); std::vector keyData = Constant::TrimCopy>(prefixKey.Data()); if (keyData.size() > Constant::MAX_KEY_LENGTH) { @@ -159,7 +159,7 @@ Status KvStoreSnapshotClient::GetKeys(const Key &prefixKey, std::vector &en Status KvStoreSnapshotClient::Get(const Key &key, Value &value) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); std::vector keyData = Constant::TrimCopy>(key.Data()); if (keyData.size() == 0 || keyData.size() > Constant::MAX_KEY_LENGTH) { diff --git a/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp b/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp index 47387a8c84b7c8a3f213f5f835ec0906dd650ad6..174e7f28708d3715ea6ec5cc5e9da3c75622d933 100755 --- a/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp +++ b/frameworks/innerkitsimpl/distributeddatafwk/src/single_kvstore_client.cpp @@ -45,7 +45,7 @@ StoreId SingleKvStoreClient::GetStoreId() const Status SingleKvStoreClient::GetEntries(const Key &prefixKey, std::vector &entries) const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ == nullptr) { ZLOGE("kvstore proxy is nullptr."); @@ -57,7 +57,7 @@ Status SingleKvStoreClient::GetEntries(const Key &prefixKey, std::vector Status SingleKvStoreClient::GetEntriesWithQuery(const std::string &query, std::vector &entries) const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ == nullptr) { ZLOGE("kvstore proxy is nullptr."); @@ -74,7 +74,7 @@ Status SingleKvStoreClient::GetEntriesWithQuery(const DataQuery &query, std::vec Status SingleKvStoreClient::GetResultSet(const Key &prefixKey, std::shared_ptr &resultSet) const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); resultSet = nullptr; Status statusTmp = Status::SERVER_UNAVAILABLE; if (kvStoreProxy_ == nullptr) { @@ -103,7 +103,7 @@ Status SingleKvStoreClient::GetResultSet(const Key &prefixKey, std::shared_ptr &resultSet) const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); resultSet = nullptr; Status statusTmp = Status::SERVER_UNAVAILABLE; @@ -157,7 +157,7 @@ Status SingleKvStoreClient::CloseResultSet(std::shared_ptr &re Status SingleKvStoreClient::GetCountWithQuery(const std::string &query, int &result) const { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ == nullptr) { ZLOGE("kvstore proxy is nullptr."); @@ -174,7 +174,7 @@ Status SingleKvStoreClient::GetCountWithQuery(const DataQuery &query, int &resul Status SingleKvStoreClient::Sync(const std::vector &deviceIds, SyncMode mode, uint32_t allowedDelayMs) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ == nullptr) { ZLOGE("kvstore proxy is nullptr."); return Status::SERVER_UNAVAILABLE; @@ -224,7 +224,7 @@ Status SingleKvStoreClient::Delete(const Key &key) Status SingleKvStoreClient::Put(const Key &key, const Value &value) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); ZLOGI("key: %zu value: %zu.", key.Size(), value.Size()); std::vector keyData = Constant::TrimCopy>(key.Data()); @@ -242,7 +242,7 @@ Status SingleKvStoreClient::Put(const Key &key, const Value &value) Status SingleKvStoreClient::Get(const Key &key, Value &value) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ == nullptr) { ZLOGE("kvstore proxy is nullptr."); @@ -346,7 +346,7 @@ Status SingleKvStoreClient::UnRegisterSyncCallback() Status SingleKvStoreClient::PutBatch(const std::vector &entries) { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); ZLOGI("entry size: %zu", entries.size()); if (entries.size() > Constant::MAX_BATCH_SIZE) { @@ -378,7 +378,7 @@ Status SingleKvStoreClient::DeleteBatch(const std::vector &keys) Status SingleKvStoreClient::StartTransaction() { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ != nullptr) { return kvStoreProxy_->StartTransaction(); @@ -389,7 +389,7 @@ Status SingleKvStoreClient::StartTransaction() Status SingleKvStoreClient::Commit() { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ != nullptr) { return kvStoreProxy_->Commit(); @@ -400,7 +400,7 @@ Status SingleKvStoreClient::Commit() Status SingleKvStoreClient::Rollback() { - DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__), true); + DdsTrace trace(std::string(LOG_TAG "::") + std::string(__FUNCTION__)); if (kvStoreProxy_ != nullptr) { return kvStoreProxy_->Rollback(); diff --git a/frameworks/jskitsimpl/distributeddata/include/js_device_kv_store.h b/frameworks/jskitsimpl/distributeddata/include/js_device_kv_store.h index aa016aeb90abd3f5d77fcc8519a06be6e6cdec79..9b2f7e2b8a096478d6fa351c4ac9307affff28b8 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_device_kv_store.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_device_kv_store.h @@ -21,7 +21,7 @@ namespace OHOS::DistributedData { class JsDeviceKVStore : public JsKVStore { public: - JsDeviceKVStore(const std::string& storeId); + explicit JsDeviceKVStore(const std::string& storeId); ~JsDeviceKVStore() = default; static napi_value Constructor(napi_env env); diff --git a/frameworks/jskitsimpl/distributeddata/include/js_field_node.h b/frameworks/jskitsimpl/distributeddata/include/js_field_node.h index 36aa79e21467c224b5c26f0f281806c84be7ff7a..62cf5a4186d0c723db829fd7c5103d789ef4cc50 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_field_node.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_field_node.h @@ -23,7 +23,7 @@ namespace OHOS::DistributedData { class JsFieldNode { public: using json = nlohmann::json; - JsFieldNode(const std::string& fName); + explicit JsFieldNode(const std::string& fName); ~JsFieldNode() = default; std::string GetFieldName(); diff --git a/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h b/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h index 545a0f6bced5af6a8672b848cbe62ddaa6b4180f..9560698ada1f321e454124ac11b52f797ae0beed 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_kv_store.h @@ -35,7 +35,7 @@ enum { */ class JsKVStore { public: - JsKVStore(const std::string& storeId); + explicit JsKVStore(const std::string& storeId); virtual ~JsKVStore(); void SetNative(std::shared_ptr& kvStore); diff --git a/frameworks/jskitsimpl/distributeddata/include/js_single_kv_store.h b/frameworks/jskitsimpl/distributeddata/include/js_single_kv_store.h index cff7d9b9e0afaf7793eaa6f82d58a7e3ac314bed..c442127126264d03cc069d01c526a4dcbb3cdd13 100644 --- a/frameworks/jskitsimpl/distributeddata/include/js_single_kv_store.h +++ b/frameworks/jskitsimpl/distributeddata/include/js_single_kv_store.h @@ -21,7 +21,7 @@ namespace OHOS::DistributedData { class JsSingleKVStore : public JsKVStore { public: - JsSingleKVStore(const std::string& storeId); + explicit JsSingleKVStore(const std::string& storeId); ~JsSingleKVStore() = default; static napi_value Constructor(napi_env env); diff --git a/frameworks/jskitsimpl/distributeddata/include/napi_queue.h b/frameworks/jskitsimpl/distributeddata/include/napi_queue.h index afb65f967eaf26cffef7697213c01c69c1720867..256a63041cf98aee7e450c96734d7348b50407fa 100644 --- a/frameworks/jskitsimpl/distributeddata/include/napi_queue.h +++ b/frameworks/jskitsimpl/distributeddata/include/napi_queue.h @@ -98,6 +98,15 @@ private: } \ } while (0) +#define ASSERT_CALL(env, theCall, object) \ + do { \ + if ((theCall) != napi_ok) { \ + delete (object); \ + GET_AND_THROW_LAST_ERROR((env)); \ + return nullptr; \ + } \ + } while (0) + class NapiQueue { public: static napi_value AsyncWork(napi_env env, std::shared_ptr ctxt, const std::string& name, diff --git a/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp index 15e513ff39b18620547a3a0bade600735fd437d9..d16f73049f30df1429ee4e1bf2e9e1b920305d27 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_device_kv_store.cpp @@ -433,7 +433,7 @@ napi_value JsDeviceKVStore::New(napi_env env, napi_callback_info info) CHECK_RETURN_VOID(kvStore != nullptr, "finalize null!"); delete kvStore; }; - NAPI_CALL(env, napi_wrap(env, ctxt->self, kvStore, finalize, nullptr, nullptr)); + ASSERT_CALL(env, napi_wrap(env, ctxt->self, kvStore, finalize, nullptr, nullptr), kvStore); return ctxt->self; } } // namespace OHOS::DistributedData diff --git a/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp b/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp index ea5b8b230dcbd3bac9488f6944826b8f4c360c40..cbc494eb0eac082e64ab61c703261c3e46808382 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_field_node.cpp @@ -93,7 +93,7 @@ napi_value JsFieldNode::New(napi_env env, napi_callback_info info) CHECK_RETURN_VOID(field != nullptr, "finalize null!"); delete field; }; - NAPI_CALL(env, napi_wrap(env, ctxt->self, fieldNode, finalize, nullptr, nullptr)); + ASSERT_CALL(env, napi_wrap(env, ctxt->self, fieldNode, finalize, nullptr, nullptr), fieldNode); return ctxt->self; } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp index 36eaf5ac25a9ad3b3edcb38ae90c9413b8d66bae..ed742f4579cec6a69f95422a8f59d8af21c75153 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_manager.cpp @@ -365,7 +365,7 @@ napi_value JsKVManager::New(napi_env env, napi_callback_info info) CHECK_RETURN_VOID(kvManager != nullptr, "finalize null!"); delete kvManager; }; - NAPI_CALL(env, napi_wrap(env, ctxt->self, kvManager, finalize, nullptr, nullptr)); + ASSERT_CALL(env, napi_wrap(env, ctxt->self, kvManager, finalize, nullptr, nullptr), kvManager); return ctxt->self; } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp b/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp index c3c5e76ce064394615a91028b4f95123398c512e..33b1557fa7c10d361eb5183844bace40d55374ca 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_kv_store_resultset.cpp @@ -68,7 +68,7 @@ napi_value JsKVStoreResultSet::New(napi_env env, napi_callback_info info) CHECK_RETURN_VOID(resultSet != nullptr, "finalize null!"); delete resultSet; }; - NAPI_CALL(env, napi_wrap(env, ctxt->self, resultSet, finalize, nullptr, nullptr)); + ASSERT_CALL(env, napi_wrap(env, ctxt->self, resultSet, finalize, nullptr, nullptr), resultSet); return ctxt->self; } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_query.cpp b/frameworks/jskitsimpl/distributeddata/src/js_query.cpp index 5791a96593d55bf180e682aa08ad86a02e5d2347..5e51afc75826ed4e9eeffa44a4149bcfd3f2b376 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_query.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_query.cpp @@ -80,7 +80,7 @@ napi_value JsQuery::New(napi_env env, napi_callback_info info) CHECK_RETURN_VOID(query != nullptr, "finalize null!"); delete query; }; - NAPI_CALL(env, napi_wrap(env, ctxt->self, query, finalize, nullptr, nullptr)); + ASSERT_CALL(env, napi_wrap(env, ctxt->self, query, finalize, nullptr, nullptr), query); return ctxt->self; } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp b/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp index 1aaeef14361c616c41109e38901dc7c2e0201b1b..5ac2add734d1880feaf06730cfd636b21dfcb00b 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_schema.cpp @@ -75,7 +75,7 @@ napi_value JsSchema::New(napi_env env, napi_callback_info info) CHECK_RETURN_VOID(schema != nullptr, "finalize null!"); delete schema; }; - NAPI_CALL(env, napi_wrap(env, ctxt->self, schema, finalize, nullptr, nullptr)); + ASSERT_CALL(env, napi_wrap(env, ctxt->self, schema, finalize, nullptr, nullptr), schema); return ctxt->self; } diff --git a/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp b/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp index 71f2fc1f3a0ef0fd6b45e70a6c99f5223828589f..604a986a057e088918869460ffa462551ebd643d 100644 --- a/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp +++ b/frameworks/jskitsimpl/distributeddata/src/js_single_kv_store.cpp @@ -455,7 +455,7 @@ napi_value JsSingleKVStore::New(napi_env env, napi_callback_info info) CHECK_RETURN_VOID(kvStore != nullptr, "finalize null!"); delete kvStore; }; - NAPI_CALL(env, napi_wrap(env, ctxt->self, kvStore, finalize, nullptr, nullptr)); + ASSERT_CALL(env, napi_wrap(env, ctxt->self, kvStore, finalize, nullptr, nullptr), kvStore); return ctxt->self; } } // namespace OHOS::DistributedData