mirror of
https://github.com/DeviceFarmer/stf.git
synced 2026-04-18 13:53:22 +02:00
fix deprecated warnings on Buffer class (#580)
Signed-off-by: Denis barbaron <denis.barbaron@orange.com> Signed-off-by: Denis barbaron <denis.barbaron@orange.com>
This commit is contained in:
@@ -72,7 +72,7 @@ module.exports = syrup.serial()
|
||||
)
|
||||
return connectService(1)
|
||||
.then(function(out) {
|
||||
var header = new Buffer(4)
|
||||
var header = Buffer.alloc(4)
|
||||
header.writeUInt16LE(0, 0)
|
||||
header.writeUInt16LE(forward.devicePort, 2)
|
||||
out.write(header)
|
||||
|
||||
@@ -5,7 +5,7 @@ var HEADER_SIZE = 4
|
||||
|
||||
function ForwardReader() {
|
||||
stream.Transform.call(this)
|
||||
this._header = new Buffer(HEADER_SIZE)
|
||||
this._header = Buffer.alloc(HEADER_SIZE)
|
||||
this._needLength = -HEADER_SIZE
|
||||
this._target = 0
|
||||
}
|
||||
|
||||
@@ -18,7 +18,7 @@ ForwardWriter.prototype._transform = function(fullChunk, encoding, done) {
|
||||
do {
|
||||
length = Math.min(MAX_PACKET_SIZE, chunk.length)
|
||||
|
||||
header = new Buffer(HEADER_SIZE)
|
||||
header = Buffer.alloc(HEADER_SIZE)
|
||||
header.writeUInt16LE(this._target, 0)
|
||||
header.writeUInt16LE(length, 2)
|
||||
|
||||
@@ -33,7 +33,7 @@ ForwardWriter.prototype._transform = function(fullChunk, encoding, done) {
|
||||
}
|
||||
|
||||
ForwardWriter.prototype._flush = function(done) {
|
||||
var header = new Buffer(HEADER_SIZE)
|
||||
var header = Buffer.alloc(HEADER_SIZE)
|
||||
header.writeUInt16LE(this._target, 0)
|
||||
header.writeUInt16LE(0, 2)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user