MCPcopy Create free account
hub / github.com/Tencent/MMKV / createNativeBuffer

Function createNativeBuffer

OpenHarmony/MMKV/src/main/cpp/native_bridge.cpp:1702–1713  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1700}
1701
1702static napi_value createNativeBuffer(napi_env env, napi_callback_info info) {
1703 size_t argc = 1;
1704 napi_value args[1] = {nullptr};
1705 NAPI_CALL(napi_get_cb_info(env, info, &argc, args, nullptr, nullptr));
1706
1707 auto size = NValueToUInt32(env, args[0]);
1708 if (size != 0) {
1709 auto ptr = malloc(size);
1710 return UInt64ToNValue(env, (uintptr_t) ptr);
1711 }
1712 return NAPIUndefined(env);
1713}
1714
1715static napi_value destroyNativeBuffer(napi_env env, napi_callback_info info) {
1716 size_t argc = 2;

Callers

nothing calls this directly

Calls 3

NValueToUInt32Function · 0.85
NAPIUndefinedFunction · 0.85
UInt64ToNValueFunction · 0.70

Tested by

no test coverage detected