mirror of
https://github.com/espruino/Espruino.git
synced 2025-12-08 19:06:15 +00:00
Work out length of typed array with offset correctly (fix #1204)
This commit is contained in:
parent
34f43c4987
commit
101dff8c97
@ -5,6 +5,7 @@
|
||||
- Handle out of memory errors in jsvCreateNewChild
|
||||
- Do not garbage collect inside an IRQ
|
||||
On nRF52 devices, allow button press at boot to clear out peer manager data
|
||||
Work out length of typed array with offset correctly (fix #1204)
|
||||
|
||||
1v93 : Ensure that specifying too many advertising UUIDs causes an exception, not a reboot
|
||||
nRF5x: Fix for time jump caused by reentrancy in jshGetSystemTime
|
||||
|
||||
@ -337,7 +337,10 @@ JsVar *jswrap_typedarray_constructor(JsVarDataArrayBufferViewType type, JsVar *a
|
||||
jsExceptionHere(JSET_ERROR, "Unsupported first argument of type %t\n", arr);
|
||||
return 0;
|
||||
}
|
||||
if (length==0) length = (JsVarInt)(jsvGetArrayBufferLength(arrayBuffer) / JSV_ARRAYBUFFER_GET_SIZE(type));
|
||||
if (length==0) {
|
||||
length = (JsVarInt)((jsvGetArrayBufferLength(arrayBuffer)-byteOffset) / JSV_ARRAYBUFFER_GET_SIZE(type));
|
||||
if (length<0) length=0;
|
||||
}
|
||||
JsVar *typedArr = jsvNewWithFlags(JSV_ARRAYBUFFER);
|
||||
if (typedArr) {
|
||||
typedArr->varData.arraybuffer.type = type;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user