Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixed compilation due to node Buffer API changes

  • Loading branch information...
commit acbcf6f2732fd3719157657ca15bfe22b6446ef6 1 parent 3f13823
Brian McKenna authored
Showing with 13 additions and 12 deletions.
  1. +13 −12 src/typedarray.h
25 src/typedarray.h
View
@@ -27,17 +27,23 @@ class Float32Array : public ObjectWrap {
void *
GetData () {
- return (void *)buf->data();
+ Local<Value> buf = handle_->GetHiddenValue(String::New("buffer"));
+
+ return (void *)Buffer::Data(buf->ToObject());
}
size_t
Length () {
- return buf->length();
+ Local<Value> buf = handle_->GetHiddenValue(String::New("buffer"));
+
+ return Buffer::Length(buf->ToObject());
}
void
Set (float *sequence, uint32_t length) {
- float *data = (float *)buf->data();
+ Local<Value> buf = handle_->GetHiddenValue(String::New("buffer"));
+
+ float *data = (float *)Buffer::Data(buf->ToObject());
for(int i = 0; i < length; i++) {
data[i] = sequence[i];
}
@@ -49,11 +55,11 @@ class Float32Array : public ObjectWrap {
New (const Arguments& args) {
HandleScope scope;
- Buffer *buf = ObjectWrap::Unwrap<Buffer>(args[0]->ToObject());
-
- Float32Array *fa = new Float32Array(buf);
+ Float32Array *fa = new Float32Array();
fa->Wrap(args.This());
+ fa->handle_->SetHiddenValue(String::New("buffer"), args[0]);
+
return args.This();
}
@@ -77,14 +83,9 @@ class Float32Array : public ObjectWrap {
return Undefined();
}
- Float32Array (Buffer *b) : ObjectWrap() {
- buf = b;
+ Float32Array () : ObjectWrap() {
}
-private:
-
- Buffer *buf;
-
};
#endif // TYPEDARRAYS_H_
Please sign in to comment.
Something went wrong with that request. Please try again.