node-opcua-binary-stream
Advanced tools
Comparing version 2.17.0 to 2.22.0
@@ -68,6 +68,5 @@ "use strict"; | ||
writeInt8(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
node_opcua_assert_1.assert(this.buffer.length >= this.length + 1, "not enough space in buffer"); | ||
} | ||
if (performCheck) { | ||
node_opcua_assert_1.assert(value >= -128 && value < 128); | ||
@@ -83,6 +82,5 @@ } | ||
writeUInt8(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
node_opcua_assert_1.assert(this.buffer.length >= this.length + 1, "not enough space in buffer"); | ||
} | ||
if (performCheck) { | ||
node_opcua_assert_1.assert(value >= 0 && value < 256, " writeUInt8 : out of bound "); | ||
@@ -98,2 +96,3 @@ } | ||
writeInt16(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -110,2 +109,3 @@ node_opcua_assert_1.assert(this.buffer.length >= this.length + 2, "not enough space in buffer"); | ||
writeUInt16(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -122,2 +122,3 @@ node_opcua_assert_1.assert(this.buffer.length >= this.length + 2, "not enough space in buffer"); | ||
writeInteger(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -135,9 +136,6 @@ node_opcua_assert_1.assert(this.buffer.length >= this.length + 4, "not enough space in buffer"); | ||
writeUInt32(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
node_opcua_assert_1.assert(this.buffer.length >= this.length + 4, "not enough space in buffer"); | ||
} | ||
if (performCheck) { | ||
node_opcua_assert_1.assert(isFinite(value)); | ||
} | ||
if (performCheck) { | ||
node_opcua_assert_1.assert(value >= 0 && value <= MAXUINT32); | ||
@@ -159,2 +157,3 @@ } | ||
writeFloat(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -171,2 +170,3 @@ node_opcua_assert_1.assert(this.buffer.length >= this.length + 4, "not enough space in buffer"); | ||
writeDouble(value) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -184,2 +184,3 @@ node_opcua_assert_1.assert(this.buffer.length >= this.length + 8, "not enough space in buffer"); | ||
writeArrayBuffer(arrayBuf, offset = 0, length = 0) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -221,2 +222,3 @@ node_opcua_assert_1.assert(arrayBuf instanceof ArrayBuffer); | ||
readUInt8() { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -305,3 +307,3 @@ node_opcua_assert_1.assert(this.buffer.length >= this.length + 1); | ||
if (value === undefined || value === null) { | ||
this.writeInteger(-1); | ||
this.writeUInt32(0xffffffff); | ||
return; | ||
@@ -311,2 +313,5 @@ } | ||
this.writeInteger(byteLength); | ||
if (byteLength === 0) { | ||
return; | ||
} | ||
// make sure there is enough room in destination buffer | ||
@@ -322,6 +327,4 @@ const remainingBytes = this.buffer.length - this.length; | ||
} | ||
if (byteLength > 0) { | ||
this.buffer.write(value, this.length); | ||
this.length += byteLength; | ||
} | ||
this.buffer.write(value, this.length); | ||
this.length += byteLength; | ||
} | ||
@@ -340,2 +343,3 @@ // readArrayBuffer(length: number): ArrayBuffer { | ||
readArrayBuffer(length) { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -345,2 +349,3 @@ node_opcua_assert_1.assert(this.length + length <= this.buffer.length, "not enough bytes in buffer"); | ||
const slice = this.buffer.slice(this.length, this.length + length); | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -350,2 +355,3 @@ node_opcua_assert_1.assert(slice.length === length); | ||
const byteArr = new Uint8Array(slice); | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -373,2 +379,3 @@ node_opcua_assert_1.assert(byteArr.length === length); | ||
const remainingBytes = this.buffer.length - this.length; | ||
// istanbul ignore next | ||
if (remainingBytes < bufLen) { | ||
@@ -396,2 +403,3 @@ throw new Error("BinaryStream.readByteStream error : not enough bytes left in buffer : bufferLength is " + | ||
const remainingBytes = this.buffer.length - this.length; | ||
// istanbul ignore next | ||
if (remainingBytes < bufLen) { | ||
@@ -419,3 +427,3 @@ throw new Error("BinaryStream.readByteStream error : not enough bytes left in buffer : bufferLength is " + | ||
let s = str.length; | ||
for (let i = str.length - 1; i >= 0; i--) { | ||
for (let i = s - 1; i >= 0; i--) { | ||
const code = str.charCodeAt(i); | ||
@@ -422,0 +430,0 @@ if (code > 0x7f && code <= 0x7ff) { |
{ | ||
"name": "node-opcua-binary-stream", | ||
"version": "2.17.0", | ||
"version": "2.22.0", | ||
"description": "pure nodejs OPCUA SDK - module -binary-stream", | ||
@@ -15,7 +15,7 @@ "main": "./dist/index.js", | ||
"colors": "^1.4.0", | ||
"node-opcua-assert": "2.16.0", | ||
"node-opcua-buffer-utils": "2.17.0" | ||
"node-opcua-assert": "2.22.0", | ||
"node-opcua-buffer-utils": "2.22.0" | ||
}, | ||
"devDependencies": { | ||
"node-opcua-benchmarker": "2.17.0", | ||
"node-opcua-benchmarker": "2.22.0", | ||
"should": "^13.2.3" | ||
@@ -38,3 +38,3 @@ }, | ||
"homepage": "http://node-opcua.github.io/", | ||
"gitHead": "545072c8184378254468c383b78e74e7e8e31ab7" | ||
"gitHead": "8eb6d67ecc89e34aa5bb99e9d6025aec2fa79743" | ||
} |
@@ -78,6 +78,5 @@ /** | ||
public writeInt8(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
assert(this.buffer.length >= this.length + 1, "not enough space in buffer"); | ||
} | ||
if (performCheck) { | ||
assert(value >= -128 && value < 128); | ||
@@ -94,6 +93,5 @@ } | ||
public writeUInt8(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
assert(this.buffer.length >= this.length + 1, "not enough space in buffer"); | ||
} | ||
if (performCheck) { | ||
assert(value >= 0 && value < 256, " writeUInt8 : out of bound "); | ||
@@ -110,2 +108,3 @@ } | ||
public writeInt16(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -123,2 +122,3 @@ assert(this.buffer.length >= this.length + 2, "not enough space in buffer"); | ||
public writeUInt16(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -136,2 +136,3 @@ assert(this.buffer.length >= this.length + 2, "not enough space in buffer"); | ||
public writeInteger(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -150,9 +151,6 @@ assert(this.buffer.length >= this.length + 4, "not enough space in buffer"); | ||
public writeUInt32(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
assert(this.buffer.length >= this.length + 4, "not enough space in buffer"); | ||
} | ||
if (performCheck) { | ||
assert(isFinite(value)); | ||
} | ||
if (performCheck) { | ||
assert(value >= 0 && value <= MAXUINT32); | ||
@@ -175,2 +173,3 @@ } | ||
public writeFloat(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -188,2 +187,3 @@ assert(this.buffer.length >= this.length + 4, "not enough space in buffer"); | ||
public writeDouble(value: number): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -202,2 +202,3 @@ assert(this.buffer.length >= this.length + 8, "not enough space in buffer"); | ||
public writeArrayBuffer(arrayBuf: ArrayBuffer, offset = 0, length = 0): void { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -243,2 +244,3 @@ assert(arrayBuf instanceof ArrayBuffer); | ||
public readUInt8(): number { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -338,3 +340,3 @@ assert(this.buffer.length >= this.length + 1); | ||
if (value === undefined || value === null) { | ||
this.writeInteger(-1); | ||
this.writeUInt32(0xffffffff); | ||
return; | ||
@@ -344,2 +346,5 @@ } | ||
this.writeInteger(byteLength); | ||
if (byteLength === 0) { | ||
return; | ||
} | ||
// make sure there is enough room in destination buffer | ||
@@ -357,6 +362,4 @@ const remainingBytes = this.buffer.length - this.length; | ||
} | ||
if (byteLength > 0) { | ||
this.buffer.write(value, this.length); | ||
this.length += byteLength; | ||
} | ||
this.buffer.write(value, this.length); | ||
this.length += byteLength; | ||
} | ||
@@ -376,2 +379,3 @@ | ||
public readArrayBuffer(length: number): Uint8Array { | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -381,2 +385,3 @@ assert(this.length + length <= this.buffer.length, "not enough bytes in buffer"); | ||
const slice = this.buffer.slice(this.length, this.length + length); | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -386,2 +391,3 @@ assert(slice.length === length); | ||
const byteArr = new Uint8Array(slice); | ||
// istanbul ignore next | ||
if (performCheck) { | ||
@@ -410,2 +416,3 @@ assert(byteArr.length === length); | ||
const remainingBytes = this.buffer.length - this.length; | ||
// istanbul ignore next | ||
if (remainingBytes < bufLen) { | ||
@@ -436,2 +443,3 @@ throw new Error( | ||
const remainingBytes = this.buffer.length - this.length; | ||
// istanbul ignore next | ||
if (remainingBytes < bufLen) { | ||
@@ -461,3 +469,3 @@ throw new Error( | ||
let s = str.length; | ||
for (let i = str.length - 1; i >= 0; i--) { | ||
for (let i = s - 1; i >= 0; i--) { | ||
const code = str.charCodeAt(i); | ||
@@ -464,0 +472,0 @@ if (code > 0x7f && code <= 0x7ff) { |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
53567
1224
+ Addednode-opcua-assert@2.22.0(transitive)
+ Addednode-opcua-buffer-utils@2.22.0(transitive)
- Removednode-opcua-assert@2.16.0(transitive)
- Removednode-opcua-buffer-utils@2.17.0(transitive)
Updatednode-opcua-assert@2.22.0