mirror of
https://github.com/nodejs/node.git
synced 2026-11-29 14:27:57 -05:00
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> Conflicts: src/node_internals.h
This commit is contained in:
1 parent
da9bd2fc48
commit
c730a5d026
2 files changed
+19
-18
No files matched your search
@@ -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
|
||||
|
||||
bool HasInstance(Local<Value> val) {
|
||||
|
||||
@@ -176,24 +176,6 @@ inline bool IsBigEndian() {
|
||||
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;
|
||||
}
|
||||
|
||||
void ThrowError(v8::Isolate* isolate, const char* errmsg);
|
||||
void ThrowTypeError(v8::Isolate* isolate, const char* errmsg);
|
||||
void ThrowRangeError(v8::Isolate* isolate, const char* errmsg);
|
||||
|
||||
Reference in new issue
Block a user