MCPcopy Create free account
hub / github.com/Moddable-OpenSource/moddable / fxGetArrayBufferData

Function fxGetArrayBufferData

xs/sources/xsDataView.c:110–121  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

108}
109
110void fxGetArrayBufferData(txMachine* the, txSlot* slot, txInteger byteOffset, void* data, txInteger byteLength)
111{
112 txSlot* instance = fxCheckArrayBufferInstance(the, slot);
113 txSlot* arrayBuffer = instance->next;
114 txSlot* bufferInfo = arrayBuffer->next;
115 txInteger length = bufferInfo->value.bufferInfo.length;
116 if ((byteOffset < 0) || (length < byteOffset))
117 mxRangeError("invalid byteOffset %ld", byteOffset);
118 if ((byteLength < 0) || (length < (byteOffset + byteLength)))
119 mxRangeError("invalid byteLength %ld", byteLength);
120 c_memcpy(data, arrayBuffer->value.arrayBuffer.address + byteOffset, byteLength);
121}
122
123txInteger fxGetArrayBufferLength(txMachine* the, txSlot* slot)
124{

Callers

nothing calls this directly

Calls 1

Tested by

no test coverage detected