Modify |getUint16| to correctly handle missing data in Stream, DecodeStream and ChunkedStream
This commit is contained in:
parent
35e668079d
commit
6dfc73a5da
@ -170,6 +170,9 @@ var ChunkedStream = (function ChunkedStreamClosure() {
|
|||||||
getUint16: function ChunkedStream_getUint16() {
|
getUint16: function ChunkedStream_getUint16() {
|
||||||
var b0 = this.getByte();
|
var b0 = this.getByte();
|
||||||
var b1 = this.getByte();
|
var b1 = this.getByte();
|
||||||
|
if (b0 === -1 || b1 === -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return (b0 << 8) + b1;
|
return (b0 << 8) + b1;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -47,6 +47,9 @@ var Stream = (function StreamClosure() {
|
|||||||
getUint16: function Stream_getUint16() {
|
getUint16: function Stream_getUint16() {
|
||||||
var b0 = this.getByte();
|
var b0 = this.getByte();
|
||||||
var b1 = this.getByte();
|
var b1 = this.getByte();
|
||||||
|
if (b0 === -1 || b1 === -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return (b0 << 8) + b1;
|
return (b0 << 8) + b1;
|
||||||
},
|
},
|
||||||
getInt32: function Stream_getInt32() {
|
getInt32: function Stream_getInt32() {
|
||||||
@ -174,6 +177,9 @@ var DecodeStream = (function DecodeStreamClosure() {
|
|||||||
getUint16: function DecodeStream_getUint16() {
|
getUint16: function DecodeStream_getUint16() {
|
||||||
var b0 = this.getByte();
|
var b0 = this.getByte();
|
||||||
var b1 = this.getByte();
|
var b1 = this.getByte();
|
||||||
|
if (b0 === -1 || b1 === -1) {
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
return (b0 << 8) + b1;
|
return (b0 << 8) + b1;
|
||||||
},
|
},
|
||||||
getInt32: function DecodeStream_getInt32() {
|
getInt32: function DecodeStream_getInt32() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user