Skip to content

Commit

Permalink
Fix linter error
Browse files Browse the repository at this point in the history
  • Loading branch information
Sampson Gao committed Sep 18, 2017
1 parent b0175ae commit 8e7bf47
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 8 deletions.
6 changes: 4 additions & 2 deletions src/node_api.cc
Original file line number Diff line number Diff line change
Expand Up @@ -939,12 +939,14 @@ NAPI_NO_RETURN void napi_fatal_error(const char* location,
char* location_string = const_cast<char*>(location);
char* message_string = const_cast<char*>(message);
if (location_len != -1) {
location_string = (char*) malloc(location_len * sizeof(char) + 1);
location_string = reinterpret_cast<char*>(
malloc(location_len * sizeof(char) + 1));
strncpy(location_string, location, location_len);
location_string[location_len] = '\0';
}
if (message_len != -1) {
message_string = (char*) malloc(message_len * sizeof(char) + 1);
message_string = reinterpret_cast<char*>(
malloc(message_len * sizeof(char) + 1));
strncpy(message_string, message, message_len);
message_string[message_len] = '\0';
}
Expand Down
4 changes: 2 additions & 2 deletions test/addons-napi/6_object_wrap/myobject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ void MyObject::Init(napi_env env, napi_value exports) {
};

napi_value cons;
NAPI_CALL_RETURN_VOID(env,
napi_define_class(env, "MyObject", -1, New, nullptr, 3, properties, &cons));
NAPI_CALL_RETURN_VOID(env, napi_define_class(
env, "MyObject", -1, New, nullptr, 3, properties, &cons));

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

Expand Down
4 changes: 2 additions & 2 deletions test/addons-napi/7_factory_wrap/myobject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ napi_status MyObject::Init(napi_env env) {
};

napi_value cons;
status =
napi_define_class(env, "MyObject", -1, New, nullptr, 1, properties, &cons);
status = napi_define_class(
env, "MyObject", -1, New, nullptr, 1, properties, &cons);
if (status != napi_ok) return status;

status = napi_create_reference(env, cons, 1, &constructor);
Expand Down
3 changes: 2 additions & 1 deletion test/addons-napi/8_passing_wrapped/myobject.cc
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ napi_status MyObject::Init(napi_env env) {
napi_status status;

napi_value cons;
status = napi_define_class(env, "MyObject", -1, New, nullptr, 0, nullptr, &cons);
status = napi_define_class(
env, "MyObject", -1, New, nullptr, 0, nullptr, &cons);
if (status != napi_ok) return status;

status = napi_create_reference(env, cons, 1, &constructor);
Expand Down
2 changes: 1 addition & 1 deletion test/addons-napi/test_constructor/test2.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@ const assert = require('assert');
// Testing api calls for a constructor that defines properties
const TestConstructor =
require(`./build/${common.buildType}/test_constructor_name`);
assert.equal(TestConstructor.name, 'MyObject');
assert.strictEqual(TestConstructor.name, 'MyObject');

0 comments on commit 8e7bf47

Please sign in to comment.