Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
Fix #2473
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Jan 10, 2012
1 parent b07acb3 commit e6a30bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 1 addition & 2 deletions src/node_buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,7 @@ namespace node {

class NODE_EXTERN Buffer: public ObjectWrap {
public:
static v8::Persistent<v8::FunctionTemplate> constructor_template;

static bool HasInstance(v8::Handle<v8::Value> val);

Expand Down Expand Up @@ -99,8 +100,6 @@ class NODE_EXTERN Buffer: public ObjectWrap {
free_callback callback, void *hint); // public constructor

private:
static v8::Persistent<v8::FunctionTemplate> constructor_template;

static v8::Handle<v8::Value> New(const v8::Arguments &args);
static v8::Handle<v8::Value> BinarySlice(const v8::Arguments &args);
static v8::Handle<v8::Value> AsciiSlice(const v8::Arguments &args);
Expand Down
14 changes: 9 additions & 5 deletions src/stream_wrap.cc
Original file line number Diff line number Diff line change
Expand Up @@ -149,13 +149,17 @@ Handle<Value> StreamWrap::ReadStop(const Arguments& args) {
}


inline char* StreamWrap::NewSlab(Handle<Object> global,
Handle<Object> wrap_obj) {
Buffer* b = Buffer::New(SLAB_SIZE);
global->SetHiddenValue(slab_sym, b->handle_);
char* StreamWrap::NewSlab(Handle<Object> global,
Handle<Object> wrap_obj) {
HandleScope scope;
Local<Value> arg = Integer::NewFromUnsigned(SLAB_SIZE);
Local<Object> b = Buffer::constructor_template->GetFunction()->
NewInstance(1, &arg);
if (b.IsEmpty()) return NULL;
global->SetHiddenValue(slab_sym, b);
assert(Buffer::Length(b) == SLAB_SIZE);
slab_used = 0;
wrap_obj->SetHiddenValue(slab_sym, b->handle_);
wrap_obj->SetHiddenValue(slab_sym, b);
return Buffer::Data(b);
}

Expand Down

0 comments on commit e6a30bd

Please sign in to comment.