You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
misleading description in doc about napi_get_typedarray_info #244
[out] data: The data buffer underlying the typed array.
[out] byte_offset: The byte offset within the data buffer from which to start projecting the TypedArray.
It seems that the data is started from &data[byte_offset],
but actually in node_api.cc,
if (data != nullptr) {
*data = static_cast<uint8_t*>(buffer->GetContents().Data()) +
array->ByteOffset();
}
if (byte_offset != nullptr) {
*byte_offset = array->ByteOffset();
}
So, the doc should clarify that the out arg data actually points to &data[byte_offset].
Activity
mhdawson commentedon May 15, 2018
Thanks for catching this. PR to fix nodejs/node#20747.
doc: fix doc for napi_get_typedarray_info
doc: fix doc for napi_get_typedarray_info
doc: fix doc for napi_get_typedarray_info