Skip to content

Commit 8e7bf47

Browse files
author
Sampson Gao
committed
Fix linter error
1 parent b0175ae commit 8e7bf47

File tree

5 files changed

+11
-8
lines changed

5 files changed

+11
-8
lines changed

src/node_api.cc

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -939,12 +939,14 @@ NAPI_NO_RETURN void napi_fatal_error(const char* location,
939939
char* location_string = const_cast<char*>(location);
940940
char* message_string = const_cast<char*>(message);
941941
if (location_len != -1) {
942-
location_string = (char*) malloc(location_len * sizeof(char) + 1);
942+
location_string = reinterpret_cast<char*>(
943+
malloc(location_len * sizeof(char) + 1));
943944
strncpy(location_string, location, location_len);
944945
location_string[location_len] = '\0';
945946
}
946947
if (message_len != -1) {
947-
message_string = (char*) malloc(message_len * sizeof(char) + 1);
948+
message_string = reinterpret_cast<char*>(
949+
malloc(message_len * sizeof(char) + 1));
948950
strncpy(message_string, message, message_len);
949951
message_string[message_len] = '\0';
950952
}

test/addons-napi/6_object_wrap/myobject.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,8 @@ void MyObject::Init(napi_env env, napi_value exports) {
2222
};
2323

2424
napi_value cons;
25-
NAPI_CALL_RETURN_VOID(env,
26-
napi_define_class(env, "MyObject", -1, New, nullptr, 3, properties, &cons));
25+
NAPI_CALL_RETURN_VOID(env, napi_define_class(
26+
env, "MyObject", -1, New, nullptr, 3, properties, &cons));
2727

2828
NAPI_CALL_RETURN_VOID(env, napi_create_reference(env, cons, 1, &constructor));
2929

test/addons-napi/7_factory_wrap/myobject.cc

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,8 @@ napi_status MyObject::Init(napi_env env) {
2121
};
2222

2323
napi_value cons;
24-
status =
25-
napi_define_class(env, "MyObject", -1, New, nullptr, 1, properties, &cons);
24+
status = napi_define_class(
25+
env, "MyObject", -1, New, nullptr, 1, properties, &cons);
2626
if (status != napi_ok) return status;
2727

2828
status = napi_create_reference(env, cons, 1, &constructor);

test/addons-napi/8_passing_wrapped/myobject.cc

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@ napi_status MyObject::Init(napi_env env) {
1717
napi_status status;
1818

1919
napi_value cons;
20-
status = napi_define_class(env, "MyObject", -1, New, nullptr, 0, nullptr, &cons);
20+
status = napi_define_class(
21+
env, "MyObject", -1, New, nullptr, 0, nullptr, &cons);
2122
if (status != napi_ok) return status;
2223

2324
status = napi_create_reference(env, cons, 1, &constructor);

test/addons-napi/test_constructor/test2.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ const assert = require('assert');
55
// Testing api calls for a constructor that defines properties
66
const TestConstructor =
77
require(`./build/${common.buildType}/test_constructor_name`);
8-
assert.equal(TestConstructor.name, 'MyObject');
8+
assert.strictEqual(TestConstructor.name, 'MyObject');

0 commit comments

Comments
 (0)