提交 7a683111 编写于 作者: H hekun

fix the code check two

Signed-off-by: Nhekun <hekun18@huawei.com>
上级 00ede221
...@@ -1324,8 +1324,8 @@ static napi_value TestLatin1(napi_env env, napi_callback_info info) { ...@@ -1324,8 +1324,8 @@ static napi_value TestLatin1(napi_env env, napi_callback_info info) {
return output; return output;
} }
// test the napi function // test the napi function
static napi_value napCreateArrayBuffer(napi_env env, napi_callback_info info) { static napi_value napCreateArrayBuffer(napi_env env, napi_callback_info info)
{
napi_value arrayBuffer = nullptr; napi_value arrayBuffer = nullptr;
void* arrayBufferPtr = nullptr; void* arrayBufferPtr = nullptr;
size_t arrayBufferSize = 1024; size_t arrayBufferSize = 1024;
...@@ -1336,8 +1336,8 @@ static napi_value napCreateArrayBuffer(napi_env env, napi_callback_info info) { ...@@ -1336,8 +1336,8 @@ static napi_value napCreateArrayBuffer(napi_env env, napi_callback_info info) {
return arrayBuffer; return arrayBuffer;
} }
static napi_value naiGetArrayBufferInfo(napi_env env, napi_callback_info info) { static napi_value naiGetArrayBufferInfo(napi_env env, napi_callback_info info)
{
// the value to return // the value to return
napi_value arrayBuffer; napi_value arrayBuffer;
napi_status status; napi_status status;
...@@ -1358,8 +1358,8 @@ static napi_value naiGetArrayBufferInfo(napi_env env, napi_callback_info info) { ...@@ -1358,8 +1358,8 @@ static napi_value naiGetArrayBufferInfo(napi_env env, napi_callback_info info) {
return arrayLength; return arrayLength;
} }
static napi_value napiNewInstance(napi_env env, napi_callback_info info) { static napi_value napiNewInstance(napi_env env, napi_callback_info info)
{
// the value to return // the value to return
napi_value global, constructor, arg, value; napi_value global, constructor, arg, value;
napi_status status = napi_get_global(env, &global); napi_status status = napi_get_global(env, &global);
...@@ -1375,8 +1375,8 @@ static napi_value napiNewInstance(napi_env env, napi_callback_info info) { ...@@ -1375,8 +1375,8 @@ static napi_value napiNewInstance(napi_env env, napi_callback_info info) {
return value; return value;
} }
static napi_value napiDefineClass(napi_env env, napi_callback_info info) { static napi_value napiDefineClass(napi_env env, napi_callback_info info)
{
napi_value testWrapClass = nullptr; napi_value testWrapClass = nullptr;
napi_define_class(env, "TestWrapClass", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info) -> napi_value { napi_define_class(env, "TestWrapClass", NAPI_AUTO_LENGTH, [](napi_env env, napi_callback_info info) -> napi_value {
napi_value thisVar = nullptr; napi_value thisVar = nullptr;
...@@ -1393,7 +1393,8 @@ static napi_value napiDefineClass(napi_env env, napi_callback_info info) { ...@@ -1393,7 +1393,8 @@ static napi_value napiDefineClass(napi_env env, napi_callback_info info) {
return value; return value;
} }
static napi_value napiRunScriptPath(napi_env env, napi_callback_info info) { static napi_value napiRunScriptPath(napi_env env, napi_callback_info info)
{
napi_value value; napi_value value;
char const* path = "/index/name"; char const* path = "/index/name";
napi_status status = napi_run_script_path(env, path, &value); napi_status status = napi_run_script_path(env, path, &value);
...@@ -1405,8 +1406,8 @@ static napi_value napiRunScriptPath(napi_env env, napi_callback_info info) { ...@@ -1405,8 +1406,8 @@ static napi_value napiRunScriptPath(napi_env env, napi_callback_info info) {
return _value; return _value;
} }
static napi_value napiGetNodeVersion(napi_env env, napi_callback_info info) { static napi_value napiGetNodeVersion(napi_env env, napi_callback_info info)
{
napi_value value; napi_value value;
const napi_node_version* version; const napi_node_version* version;
napi_get_node_version(env, &version); napi_get_node_version(env, &version);
...@@ -1419,8 +1420,8 @@ static napi_value napiGetNodeVersion(napi_env env, napi_callback_info info) { ...@@ -1419,8 +1420,8 @@ static napi_value napiGetNodeVersion(napi_env env, napi_callback_info info) {
return _value; return _value;
} }
static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info info) { static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info info)
{
void *data = nullptr; void *data = nullptr;
napi_threadsafe_function func = (napi_threadsafe_function)data; napi_threadsafe_function func = (napi_threadsafe_function)data;
napi_threadsafe_function_call_mode blockMode = napi_tsfn_nonblocking; napi_threadsafe_function_call_mode blockMode = napi_tsfn_nonblocking;
...@@ -1438,20 +1439,20 @@ static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info in ...@@ -1438,20 +1439,20 @@ static napi_value napiCallThreadsafeFunction(napi_env env, napi_callback_info in
return value; return value;
} }
static void TsFuncFinalTotalFour(napi_env env, void* finalizeData, void* hint) { static void TsFuncFinalTotalFour(napi_env env, void* finalizeData, void* hint)
{
static uv_thread_t g_uvThreadTest7; static uv_thread_t g_uvThreadTest7;
uv_thread_join(&g_uvThreadTest7); uv_thread_join(&g_uvThreadTest7);
} }
static void TsFuncCallJsFour(napi_env env, napi_value tsfn_cb, void* context, void* data) { static void TsFuncCallJsFour(napi_env env, napi_value tsfn_cb, void* context, void* data)
{
int* pData = (int32_t*)data; int* pData = (int32_t*)data;
printf("TsFuncCallJsFour is %p \n", pData); printf("TsFuncCallJsFour is %p \n", pData);
} }
static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info info) { static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info info)
{
napi_threadsafe_function tsFunc = nullptr; napi_threadsafe_function tsFunc = nullptr;
napi_value resourceName = 0; napi_value resourceName = 0;
napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName); napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
...@@ -1471,8 +1472,8 @@ static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info ...@@ -1471,8 +1472,8 @@ static napi_value napiCreateThreadsafeFunction(napi_env env, napi_callback_info
return _value; return _value;
} }
static napi_value napiCancelAsyncWork(napi_env env, napi_callback_info info) { static napi_value napiCancelAsyncWork(napi_env env, napi_callback_info info)
{
napi_async_work work = nullptr; napi_async_work work = nullptr;
napi_value resourceName = nullptr; napi_value resourceName = nullptr;
napi_create_string_utf8(env, "AsyncWorkTest", NAPI_AUTO_LENGTH, &resourceName); napi_create_string_utf8(env, "AsyncWorkTest", NAPI_AUTO_LENGTH, &resourceName);
...@@ -1489,14 +1490,15 @@ static napi_value napiCancelAsyncWork(napi_env env, napi_callback_info info) { ...@@ -1489,14 +1490,15 @@ static napi_value napiCancelAsyncWork(napi_env env, napi_callback_info info) {
return value; return value;
} }
static napi_value SayHello(napi_env env, napi_callback_info info) { static napi_value SayHello(napi_env env, napi_callback_info info)
{
printf("Hello\n"); printf("Hello\n");
return NULL; return NULL;
} }
static napi_value napiCreateFunction(napi_env env, napi_callback_info info) { static napi_value napiCreateFunction(napi_env env, napi_callback_info info)
{
napi_value funcValue = nullptr; napi_value funcValue = nullptr;
napi_status status = napi_create_function(env, NULL, 0, SayHello, NULL, &funcValue); napi_status status = napi_create_function(env, NULL, 0, SayHello, NULL, &funcValue);
NAPI_ASSERT(env, status != napi_ok, "napi_create_function fail"); NAPI_ASSERT(env, status != napi_ok, "napi_create_function fail");
...@@ -1507,8 +1509,8 @@ static napi_value napiCreateFunction(napi_env env, napi_callback_info info) { ...@@ -1507,8 +1509,8 @@ static napi_value napiCreateFunction(napi_env env, napi_callback_info info) {
} }
static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info info) { static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info info)
{
napi_threadsafe_function tsFunc = nullptr; napi_threadsafe_function tsFunc = nullptr;
napi_value resourceName = 0; napi_value resourceName = 0;
napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName); napi_create_string_latin1(env, __func__, NAPI_AUTO_LENGTH, &resourceName);
...@@ -1526,8 +1528,8 @@ static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info inf ...@@ -1526,8 +1528,8 @@ static napi_value napiRefthreadSafeFunction(napi_env env, napi_callback_info inf
return _value; return _value;
} }
static napi_value napiCreateDate(napi_env env, napi_callback_info info) { static napi_value napiCreateDate(napi_env env, napi_callback_info info)
{
napi_value createResult = nullptr; napi_value createResult = nullptr;
double time = 202110181203150; double time = 202110181203150;
napi_status status = napi_create_date(env, time, &createResult); napi_status status = napi_create_date(env, time, &createResult);
...@@ -1544,8 +1546,8 @@ static napi_value napiCreateDate(napi_env env, napi_callback_info info) { ...@@ -1544,8 +1546,8 @@ static napi_value napiCreateDate(napi_env env, napi_callback_info info) {
return value; return value;
} }
static napi_value napiCreateBigintUint64(napi_env env, napi_callback_info info) { static napi_value napiCreateBigintUint64(napi_env env, napi_callback_info info)
{
uint64_t testValue = UINT64_MAX; uint64_t testValue = UINT64_MAX;
napi_value result = nullptr; napi_value result = nullptr;
napi_create_bigint_uint64(env, testValue, &result); napi_create_bigint_uint64(env, testValue, &result);
...@@ -1573,8 +1575,8 @@ static napi_value napiCreateBigintInt64(napi_env env, napi_callback_info info) { ...@@ -1573,8 +1575,8 @@ static napi_value napiCreateBigintInt64(napi_env env, napi_callback_info info) {
return value; return value;
} }
static napi_value napiCreateBigintWords(napi_env env, napi_callback_info info) { static napi_value napiCreateBigintWords(napi_env env, napi_callback_info info)
{
int signBit = 0; int signBit = 0;
size_t wordCount = 4; size_t wordCount = 4;
uint64_t words[] = { 0xFFFFFFFFFFFFFFFF, 34ULL, 56ULL, 0xFFFFFFFFFFFFFFFF }; uint64_t words[] = { 0xFFFFFFFFFFFFFFFF, 34ULL, 56ULL, 0xFFFFFFFFFFFFFFFF };
...@@ -1592,8 +1594,8 @@ static napi_value napiCreateBigintWords(napi_env env, napi_callback_info info) { ...@@ -1592,8 +1594,8 @@ static napi_value napiCreateBigintWords(napi_env env, napi_callback_info info) {
return value; return value;
} }
static napi_value napiFatalerror(napi_env env, napi_callback_info info) { static napi_value napiFatalerror(napi_env env, napi_callback_info info)
{
void *data = nullptr; void *data = nullptr;
napi_threadsafe_function tsfun = static_cast<napi_threadsafe_function>(data); napi_threadsafe_function tsfun = static_cast<napi_threadsafe_function>(data);
if (napi_release_threadsafe_function(tsfun, napi_tsfn_release) == napi_ok) { if (napi_release_threadsafe_function(tsfun, napi_tsfn_release) == napi_ok) {
...@@ -1706,6 +1708,7 @@ static napi_value Init(napi_env env, napi_value exports) { ...@@ -1706,6 +1708,7 @@ static napi_value Init(napi_env env, napi_value exports) {
NAPI_CALL(env, napi_define_properties(env, exports, sizeof(properties) / sizeof(properties[0]), properties)); NAPI_CALL(env, napi_define_properties(env, exports, sizeof(properties) / sizeof(properties[0]), properties));
return exports; return exports;
} }
EXTERN_C_END EXTERN_C_END
static napi_module static napi_module
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册