@nxtedition/rocksdb 5.2.36 → 5.2.37
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/binding.cc
CHANGED
|
@@ -96,7 +96,7 @@ static bool HasProperty(napi_env env, napi_value obj, const std::string_view& ke
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
static napi_value GetProperty(napi_env env, napi_value obj, const std::string_view& key) {
|
|
99
|
-
napi_value value;
|
|
99
|
+
napi_value value = nullptr;
|
|
100
100
|
napi_get_named_property(env, obj, key.data(), &value);
|
|
101
101
|
return value;
|
|
102
102
|
}
|
|
@@ -226,7 +226,7 @@ napi_status Convert(napi_env env, std::string s, bool asBuffer, napi_value& resu
|
|
|
226
226
|
napi_status Convert(napi_env env, rocksdb::PinnableSlice s, bool asBuffer, napi_value& result) {
|
|
227
227
|
if (asBuffer) {
|
|
228
228
|
auto ptr = new rocksdb::PinnableSlice(std::move(s));
|
|
229
|
-
return napi_create_external_buffer(env, ptr->size(), const_cast<char*>(ptr->data()), Finalize<
|
|
229
|
+
return napi_create_external_buffer(env, ptr->size(), const_cast<char*>(ptr->data()), Finalize<rocksdb::PinnableSlice>, ptr,
|
|
230
230
|
&result);
|
|
231
231
|
} else {
|
|
232
232
|
return napi_create_string_utf8(env, s.data(), s.size(), &result);
|
|
@@ -1150,20 +1150,12 @@ NAPI_METHOD(batch_do) {
|
|
|
1150
1150
|
const auto type = StringProperty(env, element, "type");
|
|
1151
1151
|
|
|
1152
1152
|
if (type == "del") {
|
|
1153
|
-
if (!HasProperty(env, element, "key"))
|
|
1154
|
-
continue;
|
|
1155
|
-
|
|
1156
1153
|
const auto key = NapiSlice(env, GetProperty(env, element, "key"));
|
|
1157
1154
|
|
|
1158
1155
|
NAPI_PENDING_EXCEPTION();
|
|
1159
1156
|
|
|
1160
1157
|
batch.Delete(key);
|
|
1161
1158
|
} else if (type == "put") {
|
|
1162
|
-
if (!HasProperty(env, element, "key"))
|
|
1163
|
-
continue;
|
|
1164
|
-
if (!HasProperty(env, element, "value"))
|
|
1165
|
-
continue;
|
|
1166
|
-
|
|
1167
1159
|
const auto key = NapiSlice(env, GetProperty(env, element, "key"));
|
|
1168
1160
|
const auto value = NapiSlice(env, GetProperty(env, element, "value"));
|
|
1169
1161
|
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|