Skip to content
This repository has been archived by the owner on Jun 22, 2021. It is now read-only.

Commit

Permalink
Remove buffers noAssert argument
Browse files Browse the repository at this point in the history
Support for the `noAssert` argument dropped in the upcoming Node.js
v.10. This removes the argument to make sure everything works as it
should.

Refs: nodejs/node#18395
  • Loading branch information
BridgeAR authored and kriskowal committed Mar 26, 2018
1 parent 145f412 commit 92d4d42
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 25 deletions.
4 changes: 2 additions & 2 deletions i16.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ I16RW.prototype.min = -0x7fff - 1;
I16RW.prototype.max = 0x7fff;

I16RW.prototype.poolReadFrom = function poolReadFrom(result, buffer, offset) {
var value = buffer.readInt16BE(offset, true);
var value = buffer.readInt16BE(offset);
return result.reset(null, offset + this.width, value);
};

Expand All @@ -63,7 +63,7 @@ I16RW.prototype.poolWriteInto = function poolWriteInto(result, value, buffer, of
}));
}

buffer.writeInt16BE(coerced, offset, true);
buffer.writeInt16BE(coerced, offset);
return result.reset(null, offset + this.width);
};

Expand Down
4 changes: 2 additions & 2 deletions i32.js
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ I32RW.prototype.min = -0x7fffffff - 1;
I32RW.prototype.max = 0x7fffffff;

I32RW.prototype.poolReadFrom = function poolReadFrom(result, buffer, offset) {
var value = buffer.readInt32BE(offset, true);
var value = buffer.readInt32BE(offset);
return result.reset(null, offset + this.width, value);
};

Expand All @@ -63,7 +63,7 @@ I32RW.prototype.poolWriteInto = function poolWriteInto(result, value, buffer, of
}));
}

buffer.writeInt32BE(coerced, offset, true);
buffer.writeInt32BE(coerced, offset);
return result.reset(null, offset + this.width);
};

Expand Down
16 changes: 8 additions & 8 deletions i64.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@ I64RW.prototype.poolWriteInto = function poolWriteInto(destResult, value, buffer
return this.writeBufferInt64Into(destResult, value, buffer, offset);
} else if (typeof value === 'number') {
var number = Long.fromNumber(value);
buffer.writeInt32BE(number.high, offset, true);
buffer.writeInt32BE(number.low, offset + 4, true);
buffer.writeInt32BE(number.high, offset);
buffer.writeInt32BE(number.low, offset + 4);
return destResult.reset(null, offset + 8);
} else if (Array.isArray(value)) {
return this.writeArrayInt64Into(destResult, value, buffer, offset);
Expand Down Expand Up @@ -76,8 +76,8 @@ function writeObjectInt64Into(destResult, value, buffer, offset) {
'{hi[gh], lo[w]} with low bits, or other i64 representation'), null);
}
// Does not validate range of hi or lo value
buffer.writeInt32BE(value.high || value.hi, offset, true);
buffer.writeInt32BE(value.low || value.lo, offset + 4, true);
buffer.writeInt32BE(value.high || value.hi, offset);
buffer.writeInt32BE(value.low || value.lo, offset + 4);
return destResult.reset(null, offset + 8);
};

Expand Down Expand Up @@ -124,8 +124,8 @@ util.inherits(I64LongRW, I64RW);

I64LongRW.prototype.poolReadFrom = function poolReadFrom(destResult, buffer, offset) {
var value = Long.fromBits(
buffer.readInt32BE(offset + 4, 4, true),
buffer.readInt32BE(offset, 4, true)
buffer.readInt32BE(offset + 4, 4),
buffer.readInt32BE(offset, 4)
);
return destResult.reset(null, offset + 8, value);
};
Expand All @@ -138,8 +138,8 @@ util.inherits(I64DateRW, I64RW);

I64DateRW.prototype.poolReadFrom = function poolReadFrom(destResult, buffer, offset) {
var long = Long.fromBits(
buffer.readInt32BE(offset + 4, 4, true),
buffer.readInt32BE(offset + 0, 4, true)
buffer.readInt32BE(offset + 4, 4),
buffer.readInt32BE(offset + 0, 4)
);
var ms = long.toNumber();
var value = new Date(ms);
Expand Down
20 changes: 10 additions & 10 deletions message.js
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,7 @@ MessageRW.prototype.poolLegacyWriteInto = function poolLegacyWriteInto(result, m
// name~4 type:1 id:4

// name.length:4
buffer.writeUInt32BE(message.name.length, offset, true);
buffer.writeUInt32BE(message.name.length, offset);
offset += 4;

// name:name.length
Expand All @@ -212,14 +212,14 @@ MessageRW.prototype.poolLegacyWriteInto = function poolLegacyWriteInto(result, m
offset += 1;

// id:4
buffer.writeUInt32BE(message.id, offset, true);
buffer.writeUInt32BE(message.id, offset);
offset += 4;

return result.reset(null, offset);
};

MessageRW.prototype.poolReadFrom = function poolReadFrom(result, buffer, offset) {
var msb = buffer.readInt8(offset, true);
var msb = buffer.readInt8(offset);
if (msb < 0) {
result = this.poolStrictReadFrom(result, buffer, offset);
} else {
Expand Down Expand Up @@ -260,7 +260,7 @@ MessageRW.prototype.poolStrictReadFrom = function poolStrictReadFrom(result, buf
// version:2 type:2 name~4 id:4

var message = new Message();
message.version = buffer.readUInt16BE(offset, true) & ~0x8000; // mask out MSB
message.version = buffer.readUInt16BE(offset) & ~0x8000; // mask out MSB
offset += 2;

if (message.version !== 1) {
Expand All @@ -270,7 +270,7 @@ MessageRW.prototype.poolStrictReadFrom = function poolStrictReadFrom(result, buf
}

// type:2
var type = buffer.readUInt16BE(offset, true) & 0xFF;
var type = buffer.readUInt16BE(offset) & 0xFF;
offset += 2;

message.type = typeNames[type];
Expand All @@ -281,15 +281,15 @@ MessageRW.prototype.poolStrictReadFrom = function poolStrictReadFrom(result, buf
}

// name.length:4
var length = buffer.readUInt32BE(offset, true);
var length = buffer.readUInt32BE(offset);
offset += 4;

// name:name.length
message.name = buffer.toString('ascii', offset, offset + length, true);
offset += length;

// id:4
message.id = buffer.readUInt32BE(offset, true);
message.id = buffer.readUInt32BE(offset);
offset += 4;

return result.reset(null, offset, message);
Expand All @@ -300,19 +300,19 @@ MessageRW.prototype.poolLegacyReadFrom = function poolLegacyReadFrom(result, buf
var message = new Message();

// name.length
var length = buffer.readUInt32BE(offset, true);
var length = buffer.readUInt32BE(offset);
offset += 4;

// name:name.length
message.name = buffer.toString('ascii', offset, offset + length, true);
offset += length;

// type:2
var type = buffer.readUInt8(offset, true);
var type = buffer.readUInt8(offset);
offset += 1;

// id:4
message.id = buffer.readUInt32BE(offset, true);
message.id = buffer.readUInt32BE(offset);
offset += 4;

message.type = typeNames[type];
Expand Down
6 changes: 3 additions & 3 deletions skip.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ function skipField(destResult, buffer, offset) {
}), offset);
}

var typeid = buffer.readInt8(offset, true);
var typeid = buffer.readInt8(offset);
offset += 1;

return skipType(destResult, buffer, offset, typeid);
Expand Down Expand Up @@ -109,7 +109,7 @@ function skipStruct(destResult, buffer, offset) {
offset: offset
}), offset);
}
var typeid = buffer.readInt8(offset, true);
var typeid = buffer.readInt8(offset);
offset += 1;

if (typeid === TYPE.STOP) {
Expand Down Expand Up @@ -149,7 +149,7 @@ function skipString(destResult, buffer, offset) {
}), offset);
}

var length = buffer.readInt32BE(offset, true);
var length = buffer.readInt32BE(offset);
offset += 4;

// istanbul ignore if
Expand Down

0 comments on commit 92d4d42

Please sign in to comment.