@ -1,13 +1,12 @@
'use strict' ;
const buffer = process . binding ( 'buffer' ) ;
const binding = process . binding ( 'buffer' ) ;
const smalloc = process . binding ( 'smalloc' ) ;
const util = require ( 'util' ) ;
const alloc = smalloc . alloc ;
const truncate = smalloc . truncate ;
const sliceOnto = smalloc . sliceOnto ;
const kMaxLength = smalloc . kMaxLength ;
var internal = { } ;
exports . Buffer = Buffer ;
exports . SlowBuffer = SlowBuffer ;
@ -124,7 +123,7 @@ NativeBuffer.prototype = Buffer.prototype;
// add methods to Buffer prototype
buffer . setupBufferJS ( NativeBuffer , internal ) ;
binding . setupBufferJS ( NativeBuffer ) ;
// Static methods
@ -142,7 +141,7 @@ Buffer.compare = function compare(a, b) {
if ( a === b )
return 0 ;
return internal . compare ( a , b ) ;
return binding . compare ( a , b ) ;
} ;
@ -215,7 +214,7 @@ Buffer.byteLength = function(str, enc) {
ret = str . length >>> 1 ;
break ;
default :
ret = internal . byteLength ( str , enc ) ;
ret = binding . byteLength ( str , enc ) ;
}
return ret ;
} ;
@ -274,7 +273,7 @@ Buffer.prototype.equals = function equals(b) {
if ( this === b )
return true ;
return internal . compare ( this , b ) === 0 ;
return binding . compare ( this , b ) === 0 ;
} ;
@ -298,7 +297,7 @@ Buffer.prototype.compare = function compare(b) {
if ( this === b )
return 0 ;
return internal . compare ( this , b ) ;
return binding . compare ( this , b ) ;
} ;
@ -319,7 +318,7 @@ Buffer.prototype.fill = function fill(val, start, end) {
val = code ;
}
internal . fill ( this , val , start , end ) ;
binding . fill ( this , val , start , end ) ;
return this ;
} ;
@ -663,7 +662,7 @@ Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkOffset ( offset , 4 , this . length ) ;
return internal . readFloatLE ( this , offset ) ;
return binding . readFloatLE ( this , offset ) ;
} ;
@ -671,7 +670,7 @@ Buffer.prototype.readFloatBE = function readFloatBE(offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkOffset ( offset , 4 , this . length ) ;
return internal . readFloatBE ( this , offset ) ;
return binding . readFloatBE ( this , offset ) ;
} ;
@ -679,7 +678,7 @@ Buffer.prototype.readDoubleLE = function readDoubleLE(offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkOffset ( offset , 8 , this . length ) ;
return internal . readDoubleLE ( this , offset ) ;
return binding . readDoubleLE ( this , offset ) ;
} ;
@ -687,7 +686,7 @@ Buffer.prototype.readDoubleBE = function readDoubleBE(offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkOffset ( offset , 8 , this . length ) ;
return internal . readDoubleBE ( this , offset ) ;
return binding . readDoubleBE ( this , offset ) ;
} ;
@ -910,7 +909,7 @@ Buffer.prototype.writeFloatLE = function writeFloatLE(val, offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkFloat ( this , val , offset , 4 ) ;
internal . writeFloatLE ( this , val , offset ) ;
binding . writeFloatLE ( this , val , offset ) ;
return offset + 4 ;
} ;
@ -920,7 +919,7 @@ Buffer.prototype.writeFloatBE = function writeFloatBE(val, offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkFloat ( this , val , offset , 4 ) ;
internal . writeFloatBE ( this , val , offset ) ;
binding . writeFloatBE ( this , val , offset ) ;
return offset + 4 ;
} ;
@ -930,7 +929,7 @@ Buffer.prototype.writeDoubleLE = function writeDoubleLE(val, offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkFloat ( this , val , offset , 8 ) ;
internal . writeDoubleLE ( this , val , offset ) ;
binding . writeDoubleLE ( this , val , offset ) ;
return offset + 8 ;
} ;
@ -940,7 +939,7 @@ Buffer.prototype.writeDoubleBE = function writeDoubleBE(val, offset, noAssert) {
offset = offset >>> 0 ;
if ( ! noAssert )
checkFloat ( this , val , offset , 8 ) ;
internal . writeDoubleBE ( this , val , offset ) ;
binding . writeDoubleBE ( this , val , offset ) ;
return offset + 8 ;
} ;