@@ -20,13 +20,13 @@ BufferReader.prototype.tell = function() {
2020} ;
2121
2222BufferReader . prototype . seek = function ( pos ) {
23- assert ( pos > 0 && pos < this . buf . length , 'Position is Invalid' ) ;
23+ assert ( pos >= 0 && pos <= this . buf . length , 'Position is Invalid' ) ;
2424 this . offset = pos ;
2525 return this ;
2626} ;
2727
2828BufferReader . prototype . move = function ( diff ) {
29- assert ( this . offset + diff >= 0 && this . offset + diff < this . buf . length , 'Difference is Invalid' ) ;
29+ assert ( this . offset + diff >= 0 && this . offset + diff <= this . buf . length , 'Difference is Invalid' ) ;
3030 this . offset += diff ;
3131 return this ;
3232} ;
@@ -44,7 +44,7 @@ BufferReader.prototype.restAll = function() {
4444
4545BufferReader . prototype . nextBuffer = function ( length ) {
4646 assert ( length >= 0 , 'Length must be no negative' ) ;
47- assert ( this . offset + length < this . buf . length , "Out of Original Buffer's Boundary" ) ;
47+ assert ( this . offset + length <= this . buf . length , "Out of Original Buffer's Boundary" ) ;
4848 var buf = new Buffer ( length ) ;
4949 this . buf . copy ( buf , 0 , this . offset , this . offset + length ) ;
5050 this . offset += length ;
@@ -53,7 +53,7 @@ BufferReader.prototype.nextBuffer = function(length) {
5353
5454BufferReader . prototype . nextString = function ( length , encoding ) {
5555 assert ( length >= 0 , 'Length must be no negative' ) ;
56- assert ( this . offset + length < this . buf . length , "Out of Original Buffer's Boundary" ) ;
56+ assert ( this . offset + length <= this . buf . length , "Out of Original Buffer's Boundary" ) ;
5757
5858 this . offset += length ;
5959 return this . buf . toString ( encoding || 'utf8' , this . offset - length , this . offset ) ;
@@ -63,7 +63,7 @@ BufferReader.prototype.nextString = function(length, encoding) {
6363function MAKE_NEXT_READER ( valueName , size ) {
6464 valueName = cap ( valueName ) ;
6565 BufferReader . prototype [ 'next' + valueName ] = function ( ) {
66- assert ( this . offset + size < this . buf . length , "Out of Original Buffer's Boundary" ) ;
66+ assert ( this . offset + size <= this . buf . length , "Out of Original Buffer's Boundary" ) ;
6767 var val = this . buf [ 'read' + valueName ] ( this . offset ) ;
6868 this . offset += size ;
6969 return val ;
0 commit comments