This commit is contained in:
Ryan X. Charles 2014-09-17 15:44:59 -07:00
parent 6cee393c5d
commit 8e049b7244
1 changed files with 4 additions and 7 deletions

View File

@ -27,13 +27,10 @@ BufferReader.prototype.buffer = function(len) {
};
BufferReader.prototype.read = function(len) {
if (len) {
var buf = this.buf.slice(this.pos, this.pos + len);
this.pos = this.pos + len;
return buf;
}
var buf = this.buf.slice(this.pos);
this.pos = this.buf.length;
if (!len)
var len = this.buf.length;
var buf = this.buf.slice(this.pos, this.pos + len);
this.pos = this.pos + len;
return buf;
};