Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function _decodeVariantArrayDebug(stream: BinaryStream, decode: any, tracer: any, dataType: DataType) {
let cursorBefore = stream.length;
const length = decodeUInt32(stream);
let i;
let element;
tracer.trace("start_array", "Variant", length, cursorBefore, stream.length);
const n1 = Math.min(10, length);
// display a maximum of 10 elements
for (i = 0; i < n1; i++) {
tracer.trace("start_element", "", i);
cursorBefore = stream.length;
element = decode(stream);
// arr.push(element);
tracer.trace("member", "Variant", element, cursorBefore, stream.length, DataType[dataType]);
tracer.trace("end_element", "", i);
}
function _decodeVariantArrayDebug(stream, decode, tracer, dataType) {
let cursor_before = stream.length;
const length = ec.decodeUInt32(stream);
let i, element;
tracer.trace("start_array", "Variant", length, cursor_before, stream.length);
const n1 = Math.min(10, length);
// display a maximum of 10 elements
for (i = 0; i < n1; i++) {
tracer.trace("start_element", "", i);
cursor_before = stream.length;
element = decode(stream);
// arr.push(element);
tracer.trace("member", "Variant", element, cursor_before, stream.length, dataType.key);
tracer.trace("end_element", "", i);
}
// keep reading
if (length >= n1) {
for (i = n1; i < length; i++) {
function display_encodeable(value: any, buffer1: Buffer, start: number, end: number) {
const bufferExtract = buffer1.slice(start, end);
const stream = new BinaryStream(bufferExtract);
const nodeId = decodeNodeId(stream);
const encodingMask = decodeByte(stream); // 1 bin 2: xml
const length = decodeUInt32(stream);
display(chalk.green(" ExpandedNodId =") + " " + nodeId);
display(chalk.green(" encoding mask =") + " " + encodingMask);
display(chalk.green(" length =") + " " + length);
analyzePacket(bufferExtract.slice(stream.length), value.encodingDefaultBinary, padding + 2, start + stream.length);
}
public decode(stream: BinaryStream): void {
// call base class implementation first
super.decode(stream);
this.protocolVersion = decodeUInt32(stream);
this.receiveBufferSize = decodeUInt32(stream);
this.sendBufferSize = decodeUInt32(stream);
this.maxMessageSize = decodeUInt32(stream);
this.maxChunkCount = decodeUInt32(stream);
}
}
function decodeGeneralArray(dataType, stream) {
const length = ec.decodeUInt32(stream);
if (length === 0xFFFFFFFF) {
return null;
}
const decode = get_decoder(dataType);
const arr = [];
for (let i = 0; i < length; i++) {
arr.push(decode(stream));
}
return arr;
}
public decode(stream: BinaryStream): void {
super.decode(stream);
this.protocolVersion = decodeUInt32(stream);
this.receiveBufferSize = decodeUInt32(stream);
this.sendBufferSize = decodeUInt32(stream);
this.maxMessageSize = decodeUInt32(stream);
this.maxChunkCount = decodeUInt32(stream);
this.endpointUrl = decodeUAString(stream);
}
}
public decode(stream: BinaryStream): void {
super.decode(stream);
this.sequenceNumber = decodeUInt32(stream);
this.requestId = decodeUInt32(stream);
}
}
function decodeTypedArray(ArrayType, stream) {
const length = ec.decodeUInt32(stream);
if (length === 0xFFFFFFFF) {
return null;
}
const byteLength = length * ArrayType.BYTES_PER_ELEMENT;
const arr = stream.readArrayBuffer(byteLength);
const value = new ArrayType(arr.buffer);
assert(value.length === length);
return value;
}
public decode(stream: BinaryStream): void {
super.decode(stream);
this.sequenceNumber = decodeUInt32(stream);
this.requestId = decodeUInt32(stream);
}
}