Files
flipper/patches/adbkit+2.11.1.patch
Michel Weststrate da25241f7f Fix more Buffer deprecation warnings
Summary: Missed two the previous time

Reviewed By: jknoxville

Differential Revision: D18372147

fbshipit-source-id: 015f1aa93706134a8a1aacffb4812cfb284c5527
2019-11-07 09:00:19 -08:00

48 lines
1.7 KiB
Diff

diff --git a/node_modules/adbkit/lib/adb/parser.js b/node_modules/adbkit/lib/adb/parser.js
index 1b66bda..c41037d 100644
--- a/node_modules/adbkit/lib/adb/parser.js
+++ b/node_modules/adbkit/lib/adb/parser.js
@@ -52,7 +52,7 @@ Parser = (function() {
Parser.prototype.readAll = function() {
var all, endListener, errorListener, resolver, tryRead;
- all = new Buffer(0);
+ all = Buffer.alloc(0);
resolver = Promise.defer();
tryRead = (function(_this) {
return function() {
@@ -108,7 +108,7 @@ Parser = (function() {
return resolver.reject(new Parser.PrematureEOFError(howMany));
}
} else {
- return resolver.resolve(new Buffer(0));
+ return resolver.resolve(Buffer.alloc(0));
}
};
})(this);
@@ -196,7 +196,7 @@ Parser = (function() {
Parser.prototype.readUntil = function(code) {
var read, skipped;
- skipped = new Buffer(0);
+ skipped = Buffer.alloc(0);
read = (function(_this) {
return function() {
return _this.readBytes(1).then(function(chunk) {
diff --git a/node_modules/adbkit/lib/adb/protocol.js b/node_modules/adbkit/lib/adb/protocol.js
index d1377d0..2edd7ba 100644
--- a/node_modules/adbkit/lib/adb/protocol.js
+++ b/node_modules/adbkit/lib/adb/protocol.js
@@ -33,9 +33,9 @@ Protocol = (function() {
Protocol.encodeData = function(data) {
if (!Buffer.isBuffer(data)) {
- data = new Buffer(data);
+ data = Buffer.from(data);
}
- return Buffer.concat([new Buffer(Protocol.encodeLength(data.length)), data]);
+ return Buffer.concat([Buffer.from(Protocol.encodeLength(data.length)), data]);
};
return Protocol;