Skip to content

Commit 62d84ca

Browse files
committed
Remove SlowBuffer from ref (#1313)
This PR removes deprecated `SlowBuffer` support from the ref-napi library. `SlowBuffer` was deprecated in Node.js v6.0.0 and removed in later versions, making this legacy compatibility code unnecessary for modern Node.js versions. **Key Changes:** - Removed the `SlowBuffer` prototype extension block that copied Buffer methods to SlowBuffer - Eliminated the conditional check for whether `SlowBuffer` inherits from `Buffer` Fix: #1312
1 parent 4acb003 commit 62d84ca

File tree

1 file changed

+0
-45
lines changed
  • third_party/ref-napi/lib

1 file changed

+0
-45
lines changed

third_party/ref-napi/lib/ref.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1471,51 +1471,6 @@ if (Buffer.prototype[inspectSym]) {
14711471
Buffer.prototype[inspectSym] = overwriteInspect(Buffer.prototype[inspectSym]);
14721472
}
14731473

1474-
// does SlowBuffer inherit from Buffer? (node >= v0.7.9)
1475-
if (!(exports.NULL instanceof Buffer)) {
1476-
debug(
1477-
"extending SlowBuffer's prototype since it doesn't inherit from Buffer.prototype"
1478-
);
1479-
1480-
/*!
1481-
* SlowBuffer convenience methods.
1482-
*/
1483-
1484-
var SlowBuffer = require('buffer').SlowBuffer;
1485-
1486-
SlowBuffer.prototype.address = Buffer.prototype.address;
1487-
SlowBuffer.prototype.hexAddress = Buffer.prototype.hexAddress;
1488-
SlowBuffer.prototype.isNull = Buffer.prototype.isNull;
1489-
SlowBuffer.prototype.ref = Buffer.prototype.ref;
1490-
SlowBuffer.prototype.deref = Buffer.prototype.deref;
1491-
SlowBuffer.prototype.readObject = Buffer.prototype.readObject;
1492-
SlowBuffer.prototype.writeObject = Buffer.prototype.writeObject;
1493-
SlowBuffer.prototype.readPointer = Buffer.prototype.readPointer;
1494-
SlowBuffer.prototype.writePointer = Buffer.prototype.writePointer;
1495-
SlowBuffer.prototype.readCString = Buffer.prototype.readCString;
1496-
SlowBuffer.prototype.writeCString = Buffer.prototype.writeCString;
1497-
SlowBuffer.prototype.reinterpret = Buffer.prototype.reinterpret;
1498-
SlowBuffer.prototype.reinterpretUntilZeros =
1499-
Buffer.prototype.reinterpretUntilZeros;
1500-
SlowBuffer.prototype.readInt64BE = Buffer.prototype.readInt64BE;
1501-
SlowBuffer.prototype.writeInt64BE = Buffer.prototype.writeInt64BE;
1502-
SlowBuffer.prototype.readUInt64BE = Buffer.prototype.readUInt64BE;
1503-
SlowBuffer.prototype.writeUInt64BE = Buffer.prototype.writeUInt64BE;
1504-
SlowBuffer.prototype.readInt64LE = Buffer.prototype.readInt64LE;
1505-
SlowBuffer.prototype.writeInt64LE = Buffer.prototype.writeInt64LE;
1506-
SlowBuffer.prototype.readUInt64LE = Buffer.prototype.readUInt64LE;
1507-
SlowBuffer.prototype.writeUInt64LE = Buffer.prototype.writeUInt64LE;
1508-
/**
1509-
* in node 6.9.1, inspect.custom does not give a correct value; so in this case, don't torch the whole process.
1510-
* fixed in >6.9.2
1511-
*/
1512-
if (SlowBuffer.prototype[inspectSym]) {
1513-
SlowBuffer.prototype[inspectSym] = overwriteInspect(
1514-
SlowBuffer.prototype[inspectSym]
1515-
);
1516-
}
1517-
}
1518-
15191474
/**
15201475
* ...
15211476
*/

0 commit comments

Comments
 (0)