File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change @@ -72,16 +72,21 @@ class NODE_EXTERN Buffer: public ObjectWrap {
7272
7373 static bool HasInstance (v8::Handle<v8::Value> val);
7474
75- static inline char * Data (v8::Handle<v8::Object> obj) {
76- return (char *)obj->GetIndexedPropertiesExternalArrayData ();
75+ static inline char * Data (v8::Handle<v8::Value> val) {
76+ assert (val->IsObject ());
77+ void * data = val.As <v8::Object>()->GetIndexedPropertiesExternalArrayData ();
78+ return reinterpret_cast <char *>(data);
7779 }
7880
7981 static inline char * Data (Buffer *b) {
8082 return Buffer::Data (b->handle_ );
8183 }
8284
83- static inline size_t Length (v8::Handle<v8::Object> obj) {
84- return (size_t )obj->GetIndexedPropertiesExternalArrayDataLength ();
85+ static inline size_t Length (v8::Handle<v8::Value> val) {
86+ assert (val->IsObject ());
87+ int len = val.As <v8::Object>()
88+ ->GetIndexedPropertiesExternalArrayDataLength ();
89+ return static_cast <size_t >(len);
8590 }
8691
8792 static inline size_t Length (Buffer *b) {
You can’t perform that action at this time.
0 commit comments