src: move ParseArrayIndex() to src/node_buffer.cc
It's not used anywhere else so move it out of src/node_internals.h. PR-URL: https://github.com/nodejs/node/pull/7497 Reviewed-By: Anna Henningsen <anna@addaleax.net> Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: James M Snell <jasnell@gmail.com>
This commit is contained in:
parent
af273b5e81
commit
6ae20433c9
@ -193,6 +193,25 @@ void CallbackInfo::WeakCallback(Isolate* isolate) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// Parse index for external array data.
|
||||||
|
inline MUST_USE_RESULT bool ParseArrayIndex(Local<Value> 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<size_t>(tmp_i);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Buffer methods
|
// Buffer methods
|
||||||
|
|
||||||
bool HasInstance(Local<Value> val) {
|
bool HasInstance(Local<Value> val) {
|
||||||
|
@ -175,24 +175,6 @@ inline bool IsBigEndian() {
|
|||||||
return GetEndianness() == kBigEndian;
|
return GetEndianness() == kBigEndian;
|
||||||
}
|
}
|
||||||
|
|
||||||
// parse index for external array data
|
|
||||||
inline MUST_USE_RESULT bool ParseArrayIndex(v8::Local<v8::Value> 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<size_t>(tmp_i);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
class ArrayBufferAllocator : public v8::ArrayBuffer::Allocator {
|
||||||
public:
|
public:
|
||||||
inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
|
inline uint32_t* zero_fill_field() { return &zero_fill_field_; }
|
||||||
|
Loading…
x
Reference in New Issue
Block a user