1
1
'use strict' ;
2
2
3
- const buffer = process . binding ( 'buffer' ) ;
3
+ const binding = process . binding ( 'buffer' ) ;
4
4
const smalloc = process . binding ( 'smalloc' ) ;
5
5
const util = require ( 'util' ) ;
6
6
const alloc = smalloc . alloc ;
7
7
const truncate = smalloc . truncate ;
8
8
const sliceOnto = smalloc . sliceOnto ;
9
9
const kMaxLength = smalloc . kMaxLength ;
10
- var internal = { } ;
11
10
12
11
exports . Buffer = Buffer ;
13
12
exports . SlowBuffer = SlowBuffer ;
@@ -124,7 +123,7 @@ NativeBuffer.prototype = Buffer.prototype;
124
123
125
124
126
125
// add methods to Buffer prototype
127
- buffer . setupBufferJS ( NativeBuffer , internal ) ;
126
+ binding . setupBufferJS ( NativeBuffer ) ;
128
127
129
128
130
129
// Static methods
@@ -142,7 +141,7 @@ Buffer.compare = function compare(a, b) {
142
141
if ( a === b )
143
142
return 0 ;
144
143
145
- return internal . compare ( a , b ) ;
144
+ return binding . compare ( a , b ) ;
146
145
} ;
147
146
148
147
@@ -215,7 +214,7 @@ Buffer.byteLength = function(str, enc) {
215
214
ret = str . length >>> 1 ;
216
215
break ;
217
216
default :
218
- ret = internal . byteLength ( str , enc ) ;
217
+ ret = binding . byteLength ( str , enc ) ;
219
218
}
220
219
return ret ;
221
220
} ;
@@ -274,7 +273,7 @@ Buffer.prototype.equals = function equals(b) {
274
273
if ( this === b )
275
274
return true ;
276
275
277
- return internal . compare ( this , b ) === 0 ;
276
+ return binding . compare ( this , b ) === 0 ;
278
277
} ;
279
278
280
279
@@ -298,7 +297,7 @@ Buffer.prototype.compare = function compare(b) {
298
297
if ( this === b )
299
298
return 0 ;
300
299
301
- return internal . compare ( this , b ) ;
300
+ return binding . compare ( this , b ) ;
302
301
} ;
303
302
304
303
@@ -319,7 +318,7 @@ Buffer.prototype.fill = function fill(val, start, end) {
319
318
val = code ;
320
319
}
321
320
322
- internal . fill ( this , val , start , end ) ;
321
+ binding . fill ( this , val , start , end ) ;
323
322
324
323
return this ;
325
324
} ;
@@ -663,31 +662,31 @@ Buffer.prototype.readFloatLE = function readFloatLE(offset, noAssert) {
663
662
offset = offset >>> 0 ;
664
663
if ( ! noAssert )
665
664
checkOffset ( offset , 4 , this . length ) ;
666
- return internal . readFloatLE ( this , offset ) ;
665
+ return binding . readFloatLE ( this , offset ) ;
667
666
} ;
668
667
669
668
670
669
Buffer . prototype . readFloatBE = function readFloatBE ( offset , noAssert ) {
671
670
offset = offset >>> 0 ;
672
671
if ( ! noAssert )
673
672
checkOffset ( offset , 4 , this . length ) ;
674
- return internal . readFloatBE ( this , offset ) ;
673
+ return binding . readFloatBE ( this , offset ) ;
675
674
} ;
676
675
677
676
678
677
Buffer . prototype . readDoubleLE = function readDoubleLE ( offset , noAssert ) {
679
678
offset = offset >>> 0 ;
680
679
if ( ! noAssert )
681
680
checkOffset ( offset , 8 , this . length ) ;
682
- return internal . readDoubleLE ( this , offset ) ;
681
+ return binding . readDoubleLE ( this , offset ) ;
683
682
} ;
684
683
685
684
686
685
Buffer . prototype . readDoubleBE = function readDoubleBE ( offset , noAssert ) {
687
686
offset = offset >>> 0 ;
688
687
if ( ! noAssert )
689
688
checkOffset ( offset , 8 , this . length ) ;
690
- return internal . readDoubleBE ( this , offset ) ;
689
+ return binding . readDoubleBE ( this , offset ) ;
691
690
} ;
692
691
693
692
@@ -910,7 +909,7 @@ Buffer.prototype.writeFloatLE = function writeFloatLE(val, offset, noAssert) {
910
909
offset = offset >>> 0 ;
911
910
if ( ! noAssert )
912
911
checkFloat ( this , val , offset , 4 ) ;
913
- internal . writeFloatLE ( this , val , offset ) ;
912
+ binding . writeFloatLE ( this , val , offset ) ;
914
913
return offset + 4 ;
915
914
} ;
916
915
@@ -920,7 +919,7 @@ Buffer.prototype.writeFloatBE = function writeFloatBE(val, offset, noAssert) {
920
919
offset = offset >>> 0 ;
921
920
if ( ! noAssert )
922
921
checkFloat ( this , val , offset , 4 ) ;
923
- internal . writeFloatBE ( this , val , offset ) ;
922
+ binding . writeFloatBE ( this , val , offset ) ;
924
923
return offset + 4 ;
925
924
} ;
926
925
@@ -930,7 +929,7 @@ Buffer.prototype.writeDoubleLE = function writeDoubleLE(val, offset, noAssert) {
930
929
offset = offset >>> 0 ;
931
930
if ( ! noAssert )
932
931
checkFloat ( this , val , offset , 8 ) ;
933
- internal . writeDoubleLE ( this , val , offset ) ;
932
+ binding . writeDoubleLE ( this , val , offset ) ;
934
933
return offset + 8 ;
935
934
} ;
936
935
@@ -940,7 +939,7 @@ Buffer.prototype.writeDoubleBE = function writeDoubleBE(val, offset, noAssert) {
940
939
offset = offset >>> 0 ;
941
940
if ( ! noAssert )
942
941
checkFloat ( this , val , offset , 8 ) ;
943
- internal . writeDoubleBE ( this , val , offset ) ;
942
+ binding . writeDoubleBE ( this , val , offset ) ;
944
943
return offset + 8 ;
945
944
} ;
946
945
0 commit comments