Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

restore compatibility with node 0.10* #93

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fs-ext
[![Coverage Status][cov-img]][cov-url]
[![Windows Status][ci-win-img]][ci-win-url]

Extras not included in Node's fs module.
Extras not included in Node's fs module. Supports Node 0.10 upwards.

**Note**:

Expand Down
21 changes: 9 additions & 12 deletions fs-ext.cc
Original file line number Diff line number Diff line change
Expand Up @@ -242,11 +242,8 @@ static void EIO_Fcntl(uv_work_t *req) {
store_data_t* data = static_cast<store_data_t *>(req->data);

struct flock lk;
lk.l_start = 0;
lk.l_len = 0;
lk.l_type = 0;
lk.l_whence = 0;
lk.l_pid = 0;

memset(&lk, '\0', sizeof (lk));

int result = -1;
if (data->oper == F_GETLK || data->oper == F_SETLK || data->oper == F_SETLKW) {
Expand Down Expand Up @@ -347,8 +344,8 @@ static NAN_METHOD(Flock) {
store_data_t* flock_data = new store_data_t();

flock_data->fs_op = FS_OP_FLOCK;
flock_data->fd = info[0].As<v8::Int32>()->Value();
flock_data->oper = info[1].As<v8::Int32>()->Value();
flock_data->fd = Nan::To<int32_t>(info[0]).FromJust();
flock_data->oper = Nan::To<int32_t>(info[1]).FromJust();

if (info[2]->IsFunction()) {
flock_data->cb = new Nan::Callback((Local<Function>) info[2].As<Function>());
Expand Down Expand Up @@ -398,10 +395,10 @@ static NAN_METHOD(Seek) {
return THROW_BAD_ARGS;
}

int fd = info[0].As<v8::Int32>()->Value();
int fd = Nan::To<int32_t>(info[0]).FromJust();
ASSERT_OFFSET(info[1]);
off_t offs = GET_OFFSET(info[1]);
int whence = info[2].As<v8::Int32>()->Value();
int whence = Nan::To<int32_t>(info[2]).FromJust();

if ( ! info[3]->IsFunction()) {
#ifdef _WIN32
Expand Down Expand Up @@ -440,9 +437,9 @@ static NAN_METHOD(Fcntl) {
return THROW_BAD_ARGS;
}

int fd = info[0].As<v8::Int32>()->Value();
int cmd = info[1].As<v8::Int32>()->Value();
int arg = info[2].As<v8::Int32>()->Value();
int fd = Nan::To<int32_t>(info[0]).FromJust();
int cmd = Nan::To<int32_t>(info[1]).FromJust();
int arg = Nan::To<int32_t>(info[2]).FromJust();

if ( ! info[3]->IsFunction()) {
int result = fcntl(fd, cmd, arg);
Expand Down
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@
"flock",
"seek"
],
"version": "2.0.0",
"version": "2.0.2",
"homepage": "https://github.com/baudehlo/node-fs-ext/",
"repository": {
"type": "git",
"url": "git://github.com/baudehlo/node-fs-ext.git"
},
"main": "fs-ext.js",
"engines": {
"node": ">= 8.0.0"
"node": ">= 0.10"
},
"dependencies": {
"nan": "^2.14.0"
Expand Down