Skip to content

Commit 6a83a39

Browse files
author
Gergely Imreh
committed
update interface for node 12 interface changes
Change-type: patch Signed-off-by: Gergely Imreh <gergely@balena.io>
1 parent d2f232c commit 6a83a39

6 files changed

Lines changed: 26 additions & 20 deletions

File tree

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ node_js:
88
- "6"
99
- "8"
1010
- "10"
11-
- "11"
11+
- "12"
1212

1313
addons:
1414
apt:

appveyor.yml

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,16 @@ cache:
1212

1313
environment:
1414
matrix:
15+
- nodejs_version: 12
1516
- nodejs_version: 10
1617
- nodejs_version: 8
1718
- nodejs_version: 6
1819

20+
platform:
21+
- x64
22+
1923
install:
20-
- ps: Install-Product node $env:nodejs_version x64
24+
- ps: Update-NodeJsInstallation (Get-NodeJsLatestBuild $env:nodejs_version) $env:PLATFORM
2125
- choco install mingw
2226
- npm install -g --production windows-build-tools@^3.1.0
2327
# Unlike travis, appveyor doesn't clone --recursive, so we have to:

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
"async": "^2.6.1",
2525
"bluebird": "^3.5.3",
2626
"bindings": "^1.3.0",
27-
"nan": "2.11.1",
27+
"nan": "2.13.2",
2828
"prebuild-install": "^5.2.1"
2929
},
3030
"devDependencies": {

src/async.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ void init_async() {
2929
uv_async_init(uv_default_loop(), async, default_loop_entry);
3030
uv_mutex_init(&lock);
3131
if (!persistent_callback_initialized) {
32-
persistent_callback.Reset(New<v8::FunctionTemplate>(callback_wrapper)->GetFunction());
32+
persistent_callback.Reset(Nan::GetFunction(Nan::New<v8::FunctionTemplate>(callback_wrapper)).ToLocalChecked());
3333
persistent_callback_initialized = true;
3434
}
3535
}

src/js_io.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ static void js_request_done(v8::Local<v8::Value> ret, void* _s) {
2323
if (ret->IsNull()) {
2424
s->ret = 0;
2525
} else {
26-
s->ret = static_cast<errcode_t>(ret->IntegerValue());
26+
s->ret = static_cast<errcode_t>(Nan::To<int64_t>(ret).FromJust());
2727
}
2828

2929
uv_sem_post(&s->js_sem);

src/node_ext2fs.cc

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -39,18 +39,20 @@ extern "C" {
3939

4040
ext2_filsys get_filesystem(NAN_METHOD_ARGS_TYPE info) {
4141
return static_cast<ext2_filsys>(
42-
info[0]->ToObject().As<v8::External>()->Value()
42+
Nan::To<v8::Object>(info[0]).ToLocalChecked().As<v8::External>()->Value()
4343
);
4444
}
4545

4646
ext2_file_t get_file(NAN_METHOD_ARGS_TYPE info) {
4747
return static_cast<ext2_file_t>(
48-
info[0]->ToObject().As<v8::External>()->Value()
48+
Nan::To<v8::Object>(info[0]).ToLocalChecked().As<v8::External>()->Value()
4949
);
5050
}
5151

5252
unsigned int get_flags(NAN_METHOD_ARGS_TYPE info) {
53-
return static_cast<unsigned int>(info[1]->IntegerValue());
53+
return static_cast<unsigned int>(
54+
Nan::To<int64_t>(info[1]).FromJust()
55+
);
5456
}
5557

5658
std::string get_path(NAN_METHOD_ARGS_TYPE info) {
@@ -306,8 +308,8 @@ class OpenWorker : public AsyncWorker {
306308
: AsyncWorker(callback) {
307309
fs = get_filesystem(info);
308310
path = get_path(info);
309-
flags = static_cast<unsigned int>(info[2]->IntegerValue());
310-
mode = static_cast<unsigned int>(info[3]->IntegerValue());
311+
flags = static_cast<unsigned int>(Nan::To<int64_t>(info[2]).FromJust());
312+
mode = static_cast<unsigned int>(Nan::To<int64_t>(info[3]).FromJust());
311313
}
312314

313315
void Execute () {
@@ -440,9 +442,9 @@ class ReadWorker : public AsyncWorker {
440442
file = get_file(info);
441443
flags = get_flags(info);
442444
buffer = (char*) node::Buffer::Data(info[2]);
443-
offset = static_cast<unsigned long long>(info[3]->IntegerValue()); // buffer offset
444-
length = static_cast<unsigned int>(info[4]->IntegerValue());
445-
position = static_cast<unsigned long long>(info[5]->IntegerValue()); // file offset
445+
offset = static_cast<unsigned long long>(Nan::To<int64_t>(info[3]).FromJust()); // buffer offset
446+
length = static_cast<unsigned int>(Nan::To<int64_t>(info[4]).FromJust());
447+
position = static_cast<unsigned long long>(Nan::To<int64_t>(info[5]).FromJust()); // file offset
446448
}
447449

448450
void Execute () {
@@ -491,9 +493,9 @@ class WriteWorker : public AsyncWorker {
491493
file = get_file(info);
492494
flags = get_flags(info);
493495
buffer = static_cast<char*>(node::Buffer::Data(info[2]));
494-
offset = static_cast<unsigned long long>(info[3]->IntegerValue()); // buffer offset
495-
length = static_cast<unsigned int>(info[4]->IntegerValue());
496-
position = static_cast<unsigned long long>(info[5]->IntegerValue()); // file offset
496+
offset = static_cast<unsigned long long>(Nan::To<int64_t>(info[3]).FromJust()); // buffer offset
497+
length = static_cast<unsigned int>(Nan::To<int64_t>(info[4]).FromJust());
498+
position = static_cast<unsigned long long>(Nan::To<int64_t>(info[5]).FromJust()); // file offset
497499
}
498500

499501
void Execute () {
@@ -544,7 +546,7 @@ class ChModWorker : public AsyncWorker {
544546
: AsyncWorker(callback) {
545547
file = get_file(info);
546548
flags = get_flags(info);
547-
mode = static_cast<unsigned int>(info[2]->IntegerValue());
549+
mode = static_cast<unsigned int>(Nan::To<int64_t>(info[2]).FromJust());
548550
}
549551

550552
void Execute () {
@@ -582,8 +584,8 @@ class ChOwnWorker : public AsyncWorker {
582584
: AsyncWorker(callback) {
583585
file = get_file(info);
584586
flags = get_flags(info);
585-
uid = static_cast<unsigned int>(info[2]->IntegerValue());
586-
gid = static_cast<unsigned int>(info[3]->IntegerValue());
587+
uid = static_cast<unsigned int>(Nan::To<int64_t>(info[2]).FromJust());
588+
gid = static_cast<unsigned int>(Nan::To<int64_t>(info[3]).FromJust());
587589
}
588590

589591
void Execute () {
@@ -772,7 +774,7 @@ class MkDirWorker : public AsyncWorker {
772774
: AsyncWorker(callback) {
773775
fs = get_filesystem(info);
774776
path = get_path(info);
775-
mode = static_cast<unsigned int>(info[2]->IntegerValue());
777+
mode = static_cast<unsigned int>(Nan::To<int64_t>(info[2]).FromJust());
776778
}
777779

778780
void Execute () {

0 commit comments

Comments
 (0)