Commit f5dfb13f authored by Jérémy Lal's avatar Jérémy Lal

Imported Upstream version 2.0.9

parent 630240ef
# NAN ChangeLog
**Version 2.0.8: current Node 12: 0.12.7, Node 10: 0.10.40, io.js: 3.2.0**
**Version 2.0.9: current Node 4.0.0, Node 12: 0.12.7, Node 10: 0.10.40, iojs: 3.2.0**
### 2.0.9 Sep 8 2015
- Bugfix: EscapableHandleScope in Nan::NewBuffer for Node 0.8 and 0.10 b1654d7
### 2.0.8 Aug 28 2015
......
......@@ -3,7 +3,7 @@ Native Abstractions for Node.js
**A header file filled with macro and utility goodness for making add-on development for Node.js easier across versions 0.8, 0.10 and 0.12 as well as io.js.**
***Current version: 2.0.8***
***Current version: 2.0.9***
*(See [CHANGELOG.md](https://github.com/nodejs/nan/blob/master/CHANGELOG.md) for complete ChangeLog)*
......@@ -221,7 +221,7 @@ NAN's `node::Buffer` helpers exist as the API has changed across supported Node
- <a href="doc/buffers.md#api_nan_new_buffer"><b><code>Nan::NewBuffer()</code></b></a>
- <a href="doc/buffers.md#api_nan_copy_buffer"><b><code>Nan::CopyBuffer()</code></b></a>
- <a href="doc/buffers.md#api_nan_free_callback"><b><code>Nan::FreeCallback()</code></b></a>
### Nan::Callback
......
......@@ -4,7 +4,7 @@ NAN's `node::Buffer` helpers exist as the API has changed across supported Node
- <a href="#api_nan_new_buffer"><b><code>Nan::NewBuffer()</code></b></a>
- <a href="#api_nan_copy_buffer"><b><code>Nan::CopyBuffer()</code></b></a>
- <a href="#api_nan_free_callback"><b><code>Nan::FreeCallback()</code></b></a>
<a name="api_nan_new_buffer"></a>
### Nan::NewBuffer()
......@@ -20,10 +20,9 @@ Signature:
```c++
Nan::MaybeLocal<v8::Object> Nan::NewBuffer(uint32_t size)
Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char* data, uint32_t size)
// uses `node::smalloc::FreeCallback` on older versions of Node
Nan::MaybeLocal<v8::Object> Nan::NewBuffer(char *data,
size_t length,
node::Buffer::FreeCallback callback,
Nan::FreeCallback callback,
void *hint)
```
......@@ -40,3 +39,16 @@ Signature:
```c++
Nan::MaybeLocal<v8::Object> Nan::CopyBuffer(const char *data, uint32_t size)
```
<a name="api_nan_free_callback"></a>
### Nan::FreeCallback()
A free callback that can be provided to [`Nan::NewBuffer()`](#api_nan_new_buffer).
The supplied callback will be invoked when the `Buffer` undergoes garbage collection.
Signature:
```c++
typedef void (*FreeCallback)(char *data, void *hint);
```
......@@ -12,7 +12,7 @@
*
* MIT License <https://github.com/nodejs/nan/blob/master/LICENSE.md>
*
* Version 2.0.8: current Node 12: 0.12.7, Node 10: 0.10.40, io.js: 3.2.0
* Version 2.0.9: current Node 4.0.0, Node 12: 0.12.7, Node 10: 0.10.40, iojs: 3.2.0
*
* See https://github.com/nodejs/nan for the latest update to this file
**********************************************************************************/
......@@ -1026,12 +1026,12 @@ class Utf8String {
, node::Buffer::free_callback callback
, void *hint
) {
HandleScope scope;
EscapableHandleScope scope;
// arbitrary buffer lengths requires
// NODE_MODULE_VERSION >= IOJS_3_0_MODULE_VERSION
assert(length <= imp::kMaxLength && "too large buffer");
return MaybeLocal<v8::Object>(
New(node::Buffer::New(data, length, callback, hint)->handle_));
scope.Escape(New(node::Buffer::New(data, length, callback, hint)->handle_)));
}
NAN_INLINE MaybeLocal<v8::Object> CopyBuffer(
......
{
"name": "nan",
"version": "2.0.8",
"description": "Native Abstractions for Node.js: C++ header for Node 0.8->0.12 compatibility",
"version": "2.0.9",
"description": "Native Abstractions for Node.js: C++ header for Node 0.8 -> 4 compatibility",
"main": "include_dirs.js",
"repository": {
"type": "git",
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment