Skip to content

Commit

Permalink
Update Buffer API for new upstream changes
Browse files Browse the repository at this point in the history
  • Loading branch information
kkoopa committed Jul 4, 2015
1 parent 72d1f67 commit d5d3291
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion nan.h
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@ class TryCatch {
// NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
assert(size <= imp::kMaxLength && "too large buffer");
#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION
return node::Buffer::New(
return node::Buffer::Copy(
v8::Isolate::GetCurrent(), data, size);
#else
return MaybeLocal<v8::Object>(node::Buffer::New(
Expand Down Expand Up @@ -715,7 +715,11 @@ class TryCatch {
// arbitrary buffer lengths requires
// NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
assert(size <= imp::kMaxLength && "too large buffer");
#if NODE_MODULE_VERSION > IOJS_2_0_MODULE_VERSION
return node::Buffer::New(v8::Isolate::GetCurrent(), data, size);
#else
return node::Buffer::Use(v8::Isolate::GetCurrent(), data, size);
#endif
}

NAN_INLINE bool HasInstance(
Expand Down

0 comments on commit d5d3291

Please sign in to comment.