Browse Source

Removed BUFFER_DATA macro

v1.x
Tj Holowaychuk 14 years ago
parent
commit
b7c810f44e
  1. 16
      src/Canvas.cc

16
src/Canvas.cc

@ -16,16 +16,6 @@
Persistent<FunctionTemplate> Canvas::constructor; Persistent<FunctionTemplate> Canvas::constructor;
/*
* Buffer data pointer access.
*/
#if NODE_VERSION_AT_LEAST(0,3,0)
#define BUFFER_DATA(buf) Buffer::Data(buf->handle_)
#else
#define BUFFER_DATA(buf) buf->data()
#endif
/* /*
* Initialize Canvas. * Initialize Canvas.
*/ */
@ -161,7 +151,7 @@ Canvas::EIO_AfterToBuffer(eio_req *req) {
closure->pfn->Call(Context::GetCurrent()->Global(), 1, argv); closure->pfn->Call(Context::GetCurrent()->Global(), 1, argv);
} else { } else {
Buffer *buf = Buffer::New(closure->len); Buffer *buf = Buffer::New(closure->len);
memcpy(BUFFER_DATA(buf), closure->data, closure->len); memcpy(Buffer::Data(buf->handle_), closure->data, closure->len);
Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(buf->handle_) }; Local<Value> argv[2] = { Local<Value>::New(Null()), Local<Value>::New(buf->handle_) };
closure->pfn->Call(Context::GetCurrent()->Global(), 2, argv); closure->pfn->Call(Context::GetCurrent()->Global(), 2, argv);
} }
@ -207,7 +197,7 @@ Canvas::ToBuffer(const Arguments &args) {
return ThrowException(Canvas::Error(status)); return ThrowException(Canvas::Error(status));
} else { } else {
Buffer *buf = Buffer::New(closure.len); Buffer *buf = Buffer::New(closure.len);
memcpy(BUFFER_DATA(buf), closure.data, closure.len); memcpy(Buffer::Data(buf->handle_), closure.data, closure.len);
return buf->handle_; return buf->handle_;
} }
} }
@ -222,7 +212,7 @@ streamPNG(void *c, const uint8_t *data, unsigned len) {
HandleScope scope; HandleScope scope;
closure_t *closure = (closure_t *) c; closure_t *closure = (closure_t *) c;
Local<Buffer> buf = Buffer::New(len); Local<Buffer> buf = Buffer::New(len);
memcpy(BUFFER_DATA(buf), data, len); memcpy(Buffer::Data(buf->handle_), data, len);
Local<Value> argv[3] = { Local<Value> argv[3] = {
Local<Value>::New(Null()) Local<Value>::New(Null())
, Local<Value>::New(buf->handle_) , Local<Value>::New(buf->handle_)

Loading…
Cancel
Save