Merge pull request #11301 from Snuffleupagus/peekByte-eof
Ensure that the `peekByte` methods, on the various Streams, handles end of data correctly (PR 5286 follow-up)
This commit is contained in:
commit
0eda75c8fd
@ -213,7 +213,9 @@ class ChunkedStream {
|
|||||||
|
|
||||||
peekByte() {
|
peekByte() {
|
||||||
const peekedByte = this.getByte();
|
const peekedByte = this.getByte();
|
||||||
this.pos--;
|
if (peekedByte !== -1) {
|
||||||
|
this.pos--;
|
||||||
|
}
|
||||||
return peekedByte;
|
return peekedByte;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,7 +86,9 @@ var Stream = (function StreamClosure() {
|
|||||||
},
|
},
|
||||||
peekByte: function Stream_peekByte() {
|
peekByte: function Stream_peekByte() {
|
||||||
var peekedByte = this.getByte();
|
var peekedByte = this.getByte();
|
||||||
this.pos--;
|
if (peekedByte !== -1) {
|
||||||
|
this.pos--;
|
||||||
|
}
|
||||||
return peekedByte;
|
return peekedByte;
|
||||||
},
|
},
|
||||||
peekBytes(length, forceClamped = false) {
|
peekBytes(length, forceClamped = false) {
|
||||||
@ -234,7 +236,9 @@ var DecodeStream = (function DecodeStreamClosure() {
|
|||||||
},
|
},
|
||||||
peekByte: function DecodeStream_peekByte() {
|
peekByte: function DecodeStream_peekByte() {
|
||||||
var peekedByte = this.getByte();
|
var peekedByte = this.getByte();
|
||||||
this.pos--;
|
if (peekedByte !== -1) {
|
||||||
|
this.pos--;
|
||||||
|
}
|
||||||
return peekedByte;
|
return peekedByte;
|
||||||
},
|
},
|
||||||
peekBytes(length, forceClamped = false) {
|
peekBytes(length, forceClamped = false) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user