This commit is contained in:
Spaceboy Ross 2018-11-14 12:05:24 -08:00
parent d1868d5ee8
commit 66bc53624d
9 changed files with 21 additions and 21 deletions

View file

@ -464,7 +464,7 @@ var templates = {
function(mode, wid, name, type, units, data)
{
var padded4 = (data.length + 3) >> 2;
var pad = new Buffer( (padded4<<2) - data.length);
var pad = Buffer.alloc( (padded4<<2) - data.length);
var format = 'CCSLLLCxxxLaa';
var requestLength = 6 + padded4;
var dataLenInFormatUnits = data.length / (units >> 3);
@ -850,7 +850,7 @@ var templates = {
var padded = xutil.padded_length(data.length);
var reqLen = 6 + padded/4; // (length + 3) >> 2 ???
var padLength = padded - data.length;
var pad = new Buffer(padLength); // TODO: new pack format 'X' - skip amount of bytes supplied in numerical argument
var pad = Buffer.alloc(padLength); // TODO: new pack format 'X' - skip amount of bytes supplied in numerical argument
// TODO: move code to calculate reqLength and use BigReq if needed outside of corereq.js
// NOTE: big req is used here (first 'L' in format, 0 and +1 in params), won't work if not enabled

View file

@ -258,7 +258,7 @@ exports.requireExt = function(display, callback)
ext.BindTexImage = function(ctx, drawable, buffer, attribs) {
if (!attribs)
attribs = [];
var data = new Buffer(12 + attribs.length*4);
var data = Buffer.alloc(12 + attribs.length*4);
data.writeUInt32LE(drawable, 0);
data.writeUInt32LE(buffer, 4);
data.writeUInt32LE(attribs.length, 8);
@ -268,7 +268,7 @@ exports.requireExt = function(display, callback)
}
ext.ReleaseTexImage = function(ctx, drawable, buffer) {
var data = new Buffer(8);
var data = Buffer.alloc(8);
data.writeUint32LE(drawable, 0);
data.writeUint32LE(buffer, 4);
ext.VendorPrivate(ctx, 1331, data);
@ -287,7 +287,7 @@ exports.requireExt = function(display, callback)
X.pack_stream.pack('CCSLSSL', [ext.majorOpcode, 2, length, ctx, requestNum, requestTotal, data.length]);
X.pack_stream.write_queue.push(data);
var pad = new Buffer(padLength);
var pad = Buffer.alloc(padLength);
pad.fill(0);
X.pack_stream.write_queue.push(pad);
X.pack_stream.flush();

View file

@ -16,7 +16,7 @@ module.exports = function(GLX, ctx) {
throw Error('Buffer too big. Make sure you are using RenderLarge for large commands');
currentLength += len;
var res = Buffer(len);
var res = Buffer.alloc(len);
res.writeUInt16LE(len, 0);
res.writeUInt16LE(opcode, 2);
return res;
@ -266,7 +266,7 @@ module.exports = function(GLX, ctx) {
typeSize[constants.BYTE] = 1;
typeSize[constants.UNSIGNED_BYTE] = 1;
var res = new Buffer(60 + data.length*typeSize[type]);
var res = Buffer.alloc(60 + data.length*typeSize[type]);
res.writeUInt32LE(res.length, 0);
res.writeUInt32LE(110, 4);

View file

@ -437,7 +437,7 @@ exports.requireExt = function(display, callback)
glyph = glyphs[i];
if (glyph.width % 4 !== 0) {
var stride = (glyph.width+3)&~3;
var res = new Buffer(glyph.height*stride);
var res = Buffer.alloc(glyph.height*stride);
res.fill(0);
for (var y=0; y < glyph.height; ++y) {
glyph.image.copy(res, y*stride, y*glyph.width, y*glyph.width + glyph.width);
@ -503,7 +503,7 @@ exports.requireExt = function(display, callback)
function wstring(bits, s) {
var charLength = bits / 8;
var dataLength = s.length*charLength;
var res = new Buffer(xutil.padded_length(dataLength));
var res = Buffer.alloc(xutil.padded_length(dataLength));
debugger;
var write = res[bufferWriteBits[bits]]
res.fill(0);

View file

@ -7,7 +7,7 @@
// It should create a pleasant looking hex dumb by default:
//
// var hexy = require('hexy.js'),
// b = new Buffer("\000\001\003\005\037\012\011bcdefghijklmnopqrstuvwxyz0123456789")
// b = Buffer.alloc("\000\001\003\005\037\012\011bcdefghijklmnopqrstuvwxyz0123456789")
//
// console.log(hexy.hexy(b))
//
@ -258,4 +258,4 @@ console.log(hexy(data, format))
console.log("doen")
*/
exports.hexy = hexy
exports.hexy = hexy

View file

@ -23,7 +23,7 @@ function ReadFixedRequest(length, callback)
{
this.length = length;
this.callback = callback;
this.data = new Buffer(length);
this.data = Buffer.alloc(length);
this.received_bytes = 0;
}
@ -201,7 +201,7 @@ UnpackStream.prototype.pstr = function(str)
var len = xutil.padded_length(str.length);
if (len == 0)
return; // nothing to write
var buf = new Buffer(len);
var buf = Buffer.alloc(len);
buf.write(str, 'binary');
this.write_queue.push(buf);
}
@ -231,7 +231,7 @@ UnpackStream.prototype.pack = function(format, args)
}
}
var buf = new Buffer(packetlength);
var buf = Buffer.alloc(packetlength);
var offset = 0;
var arg = 0;
for (var i = 0; i < format.length; ++i)

View file

@ -508,7 +508,7 @@ XClient.prototype.expectReplyHeader = function()
// raw event 32-bytes packet (primarily for use in SendEvent);
// TODO: Event::pack based on event parameters, inverse to unpackEvent
ev.rawData = new Buffer(32);
ev.rawData = Buffer.alloc(32);
headerBuf.copy(ev.rawData);
buf.copy(ev.rawData, 8);

View file

@ -27,7 +27,7 @@ describe('ChangeProperty', function() {
var self = this;
this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) {
should.not.exist(err);
var raw = new Buffer(4);
var raw = Buffer.alloc(4);
raw.writeUInt32LE(self.wid, 0);
self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.WINDOW, 32, raw);
self.X.once('event', function(ev) {
@ -47,7 +47,7 @@ describe('ChangeProperty', function() {
var self = this;
this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) {
should.not.exist(err);
var raw = new Buffer(new Array(8));
var raw = Buffer.from(new Array(8));
raw.writeUInt32LE(self.wid, 0);
raw.writeUInt32LE(self.wid_helper, 4);
self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.ATOM, 32, raw);
@ -69,7 +69,7 @@ describe('ChangeProperty', function() {
var self = this;
this.X.InternAtom(false, TEST_PROPERTY, function(err, atom) {
should.not.exist(err);
var raw = new Buffer(0);
var raw = Buffer.alloc(0);
self.X.ChangeProperty(0, self.wid, atom, self.X.atoms.WINDOW, 32, raw);
self.X.once('event', function(ev) {
ev.type.should.equal(28);

View file

@ -40,7 +40,7 @@ describe('ClientMessage', function() {
});
var X = dpy.client;
var eventData = new Buffer(32);
var eventData = Buffer.alloc(32);
eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage
eventData.writeInt8(8, 1); //Format
eventData.writeInt32LE(self.wid, 4); //Window ID
@ -67,7 +67,7 @@ describe('ClientMessage', function() {
});
var X = dpy.client;
var eventData = new Buffer(32);
var eventData = Buffer.alloc(32);
eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage
eventData.writeInt8(16, 1); //Format
eventData.writeInt32LE(self.wid, 4); //Window ID
@ -94,7 +94,7 @@ describe('ClientMessage', function() {
});
var X = dpy.client;
var eventData = new Buffer(32);
var eventData = Buffer.alloc(32);
eventData.writeInt8(33, 0); //Event Type 33 = ClientMessage
eventData.writeInt8(32, 1); //Format
eventData.writeInt32LE(self.wid, 4); //Window ID