More arraybuffer iteration fixes

This commit is contained in:
Gordon Williams 2013-10-10 11:11:34 +01:00
parent 2be76e3468
commit a1ce503e03
5 changed files with 4 additions and 2 deletions

View File

@ -3,6 +3,7 @@
[ebirger] Ensuring integers with radix specifiers can still be parsed if a radix is specified
Fix for tests/test_json_arraybuffer_001.js - iteration of arraybuffers of length==1
Add Object.keys(...)
More arraybuffer iteration fixes
1v40 : Ensure that LCD.prototype.setPixel = function actually works
Refactor LCD driver code to allow lcdInit (and start of making it non-platform-specific)

View File

@ -2309,8 +2309,8 @@ void jsvArrayBufferIteratorNew(JsvArrayBufferIterator *it, JsVar *arrayBuffer,
}
assert(jsvIsString(arrayBufferData));
it->byteLength += it->byteOffset; // because we'll check if we have more bytes using this
it->byteOffset = it->byteOffset + index*JSV_ARRAYBUFFER_GET_SIZE(it->type);
it->byteLength += it->byteOffset;
if (it->byteOffset<0 || (it->byteLength>=0 && it->byteOffset>=(it->byteLength+1-JSV_ARRAYBUFFER_GET_SIZE(it->type)))) {
jsvUnLock(arrayBufferData);
it->type = ARRAYBUFFERVIEW_UNDEFINED;

View File

@ -6,9 +6,10 @@ var b = new Int8Array(buf, 3);
var c = new Int8Array(buf, 1,1);
a[4] = 5;
b[2] = 6;
c[0] = 42;
c[1] = 7; // Ignored as out of range
r = ""+a;
l = c.byteLength;
result= r == "0,0,0,0,5,6" && l==1;
result= r == "0,42,0,0,5,6" && l==1;