aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authordaurnimator <quae@daurnimator.com>2017-12-13 17:17:43 +1100
committerdaurnimator <quae@daurnimator.com>2017-12-15 14:52:58 +1100
commitaf95e27d1b2d5f0f39534523778003dfd1fcf417 (patch)
treedd604e436b5af6ae1066be0c076e3dcb14deb2b3 /src
parent60181181128144f483bbf344ef51b2ce5385a3c0 (diff)
downloadfengari-af95e27d1b2d5f0f39534523778003dfd1fcf417.tar.gz
fengari-af95e27d1b2d5f0f39534523778003dfd1fcf417.tar.bz2
fengari-af95e27d1b2d5f0f39534523778003dfd1fcf417.zip
src/lzio.js: Don't permit DataView returned from a lua_load reader any more
Diffstat (limited to 'src')
-rw-r--r--src/lzio.js15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/lzio.js b/src/lzio.js
index efd7909..a00a24b 100644
--- a/src/lzio.js
+++ b/src/lzio.js
@@ -48,22 +48,15 @@ class ZIO {
const EOZ = -1;
const luaZ_fill = function(z) {
- let size;
let buff = z.reader(z.L, z.data);
if (buff === null)
return EOZ;
- if (buff instanceof DataView) {
- z.buffer = new Uint8Array(buff.buffer, buff.byteOffset, buff.byteLength);
- z.off = 0;
- size = buff.byteLength - buff.byteOffset;
- } else {
- assert(buff instanceof Uint8Array, "Should only load binary of array of bytes");
- z.buffer = buff;
- z.off = 0;
- size = buff.length;
- }
+ assert(buff instanceof Uint8Array, "Should only load binary of array of bytes");
+ let size = buff.length;
if (size === 0)
return EOZ;
+ z.buffer = buff;
+ z.off = 0;
z.n = size - 1;
return z.buffer[z.off++];
};