diff --git a/src/node_buffer.cc b/src/node_buffer.cc index dfdf68b9ce5584..011f67fa799913 100644 --- a/src/node_buffer.cc +++ b/src/node_buffer.cc @@ -171,6 +171,25 @@ void CallbackInfo::WeakCallback(Isolate* isolate, Local object) { } +// Parse index for external array data. +inline MUST_USE_RESULT bool ParseArrayIndex(Local arg, + size_t def, + size_t* ret) { + if (arg->IsUndefined()) { + *ret = def; + return true; + } + + int64_t tmp_i = arg->IntegerValue(); + + if (tmp_i < 0) + return false; + + *ret = static_cast(tmp_i); + return true; +} + + // Buffer methods bool HasInstance(Local val) { diff --git a/src/node_internals.h b/src/node_internals.h index ae1256756c31db..ef3af51018c9a0 100644 --- a/src/node_internals.h +++ b/src/node_internals.h @@ -160,24 +160,6 @@ inline bool IsBigEndian() { return GetEndianness() == kBigEndian; } -// parse index for external array data -inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local arg, - size_t def, - size_t* ret) { - if (arg->IsUndefined()) { - *ret = def; - return true; - } - - int32_t tmp_i = arg->Int32Value(); - - if (tmp_i < 0) - return false; - - *ret = static_cast(tmp_i); - return true; -} - void ThrowError(v8::Isolate* isolate, const char* errmsg); void ThrowTypeError(v8::Isolate* isolate, const char* errmsg); void ThrowRangeError(v8::Isolate* isolate, const char* errmsg);