|
27 | 27 | * static ArrayBuffer* New(const std::string &data) |
28 | 28 | * static ArrayBuffer* New(const v8::Local<v8::Object> &arrayBuffer) |
29 | 29 | * static ArrayBuffer* New(const v8::Local<v8::Value> &arg) |
30 | | -* |
| 30 | +* |
31 | 31 | * v8::Local<v8::Object> ToArrayBuffer() const |
32 | 32 | * v8::Local<v8::String> ToString() const |
33 | 33 | * |
@@ -75,26 +75,26 @@ namespace node { |
75 | 75 | class ArrayBuffer { |
76 | 76 | public: |
77 | 77 | inline static ArrayBuffer* New(const char *str = 0) { |
78 | | -#if NODE_MINOR_VERSION > 11 |
| 78 | +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION |
79 | 79 | return ArrayBuffer::New(v8::Isolate::GetCurrent(), std::string(str)); |
80 | | -#else |
| 80 | +#else |
81 | 81 | return ArrayBuffer::New(std::string(str)); |
82 | 82 | #endif |
83 | 83 | } |
84 | 84 |
|
85 | 85 | inline static ArrayBuffer* New(const std::string &data) { |
86 | | -#if NODE_MINOR_VERSION > 11 |
| 86 | +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION |
87 | 87 | return ArrayBuffer::New(v8::Isolate::GetCurrent(), data.data(), data.size()); |
88 | 88 | #else |
89 | 89 | return ArrayBuffer::New(data.data(), data.size()); |
90 | 90 | #endif |
91 | 91 | } |
92 | 92 |
|
93 | | -#if NODE_MINOR_VERSION > 11 |
| 93 | +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION |
94 | 94 | inline static ArrayBuffer* New(const char *str, size_t length) { |
95 | 95 | return ArrayBuffer::New(v8::Isolate::GetCurrent(), str, length); |
96 | 96 | } |
97 | | - |
| 97 | + |
98 | 98 | inline static ArrayBuffer* New(const v8::Local<v8::ArrayBuffer> &arrayBuffer) { |
99 | 99 | return ArrayBuffer::New(v8::Isolate::GetCurrent(), arrayBuffer); |
100 | 100 | } |
@@ -325,7 +325,7 @@ namespace node { |
325 | 325 | return _len; |
326 | 326 | } |
327 | 327 |
|
328 | | -#if NODE_MINOR_VERSION > 11 |
| 328 | +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION |
329 | 329 | static inline void onDispose(const v8::WeakCallbackData<v8::ArrayBuffer, ArrayBuffer> &info) { |
330 | 330 | v8::Isolate *isolate = info.GetIsolate(); |
331 | 331 | v8::HandleScope scope(isolate); |
@@ -362,22 +362,22 @@ namespace node { |
362 | 362 |
|
363 | 363 | private: |
364 | 364 | virtual ~ArrayBuffer() { |
365 | | -#if NODE_MINOR_VERSION > 11 |
| 365 | +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION |
366 | 366 | if (_len) { |
367 | 367 | delete [] _data; |
368 | 368 | } |
369 | 369 | #else |
370 | 370 | _arrayBuffer.ClearWeak(); |
371 | 371 | _arrayBuffer.Dispose(); |
372 | | - _arrayBuffer.Clear(); |
| 372 | + _arrayBuffer.Clear(); |
373 | 373 | #endif |
374 | 374 | } |
375 | 375 |
|
376 | 376 | protected: |
377 | 377 | char* _data; |
378 | 378 | size_t _len; |
379 | 379 |
|
380 | | -#if NODE_MINOR_VERSION > 11 |
| 380 | +#if NODE_MODULE_VERSION >= NODE_0_12_MODULE_VERSION |
381 | 381 | v8::Persistent<v8::ArrayBuffer> _arrayBuffer; |
382 | 382 | #else |
383 | 383 | v8::Persistent<v8::Object> _arrayBuffer; |
|
0 commit comments