Skip to content

Commit

Permalink
Fix xcode vector assign error (#1)
Browse files Browse the repository at this point in the history
* Fix xcode vector assign error
  • Loading branch information
anisha-rohra authored and mhdawson committed Jan 8, 2018
1 parent cd7a435 commit 25a84c0
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 5 deletions.
1 change: 1 addition & 0 deletions binding.gyp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
}
]
],
'defines': [ 'NAPI_DISABLE_CPP_EXCEPTIONS' ],
"cflags": [ "-include ../src/gcc-preinclude.h" ],
"sources": [
"src/database.cc",
Expand Down
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@
"url": "git://github.com/mapbox/node-sqlite3.git"
},
"dependencies": {
"node-addon-api": "^1.0.0",
"node-pre-gyp": "^0.6.38"
"node-addon-api": "^1.1.0",
"node-pre-gyp": "^0.6.39"
},
"bundledDependencies": [
"node-pre-gyp"
Expand Down
2 changes: 1 addition & 1 deletion src/database.cc
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ Database::Database(const Napi::CallbackInfo& info) : Napi::ObjectWrap<Database>(
Napi::Env env = info.Env();

REQUIRE_ARGUMENT_STRING(0, filename);
int pos = 1;
unsigned int pos = 1;

int mode;
if (info.Length() >= pos && info[pos].IsNumber()) {
Expand Down
7 changes: 5 additions & 2 deletions src/macros.h
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,13 @@ inline Napi::String StringConcat(Napi::Value str1, Napi::Value str2) {
argc, argv \
);

// The Mac OS compiler complains when argv is NULL unless we
// first assign it to a locally defined variable.
#define TRY_CATCH_CALL(context, callback, argc, argv) \
Napi::Value* passed_argv = argv;\
std::vector<napi_value> args;\
if (argc != 0 && argv != NULL) {\
args.assign(argv, argv + argc);\
if ((argc != 0) && (passed_argv != NULL)) {\
args.assign(passed_argv, passed_argv + argc);\
}\
(callback).MakeCallback(Napi::Value(context), args);

Expand Down

0 comments on commit 25a84c0

Please sign in to comment.