summaryrefslogtreecommitdiff
path: root/src/node_buffer.cc
diff options
context:
space:
mode:
authorRyan Dahl <ry@tinyclouds.org>2010-11-11 14:26:41 -0800
committerRyan Dahl <ry@tinyclouds.org>2010-11-18 16:47:37 -0800
commitd74c5060447c01044e4122d9bcda9482bda2a351 (patch)
treee47b9728a50758249750321b9bb3d5dab265fef3 /src/node_buffer.cc
parentdcc547d798c11ed81f4617724a0120dad484d0ce (diff)
downloadnodejs-d74c5060447c01044e4122d9bcda9482bda2a351.tar.gz
nodejs-d74c5060447c01044e4122d9bcda9482bda2a351.tar.bz2
nodejs-d74c5060447c01044e4122d9bcda9482bda2a351.zip
Support encoding
Diffstat (limited to 'src/node_buffer.cc')
-rw-r--r--src/node_buffer.cc8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/node_buffer.cc b/src/node_buffer.cc
index 8d7fc6dc9..d838577a1 100644
--- a/src/node_buffer.cc
+++ b/src/node_buffer.cc
@@ -82,7 +82,8 @@ static size_t ByteLength (Handle<String> string, enum encoding enc) {
}
-Handle<Object> Buffer::New(Handle<String> string) {
+Handle<Object> Buffer::New(Handle<String> string,
+ Handle<Value> encoding) {
HandleScope scope;
// get Buffer from global scope.
@@ -91,8 +92,9 @@ Handle<Object> Buffer::New(Handle<String> string) {
assert(bv->IsFunction());
Local<Function> b = Local<Function>::Cast(bv);
- Local<Value> argv[1] = { Local<Value>::New(string) };
- Local<Object> instance = b->NewInstance(1, argv);
+ Local<Value> argv[2] = { Local<Value>::New(string),
+ Local<Value>::New(encoding) };
+ Local<Object> instance = b->NewInstance(2, argv);
return scope.Close(instance);
}