Merge pull request #11334 from Snuffleupagus/FlateStream-readBlock-getBytes
Use `getBytes`, rather than looping over `getByte`, in `FlateStream.prototype.readBlock`
This commit is contained in:
commit
789c2c6a7e
@ -580,21 +580,19 @@ var FlateStream = (function FlateStreamClosure() {
|
|||||||
this.codeBuf = 0;
|
this.codeBuf = 0;
|
||||||
this.codeSize = 0;
|
this.codeSize = 0;
|
||||||
|
|
||||||
var bufferLength = this.bufferLength;
|
const bufferLength = this.bufferLength, end = bufferLength + blockLen;
|
||||||
buffer = this.ensureBuffer(bufferLength + blockLen);
|
buffer = this.ensureBuffer(end);
|
||||||
var end = bufferLength + blockLen;
|
|
||||||
this.bufferLength = end;
|
this.bufferLength = end;
|
||||||
|
|
||||||
if (blockLen === 0) {
|
if (blockLen === 0) {
|
||||||
if (str.peekByte() === -1) {
|
if (str.peekByte() === -1) {
|
||||||
this.eof = true;
|
this.eof = true;
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
for (var n = bufferLength; n < end; ++n) {
|
const block = str.getBytes(blockLen);
|
||||||
if ((b = str.getByte()) === -1) {
|
buffer.set(block, bufferLength);
|
||||||
this.eof = true;
|
if (block.length < blockLen) {
|
||||||
break;
|
this.eof = true;
|
||||||
}
|
|
||||||
buffer[n] = b;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user