Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function readUTF8String(): DecodedUTF8String {
const lenu32 = readU32();
// Don't eat any bytes. Instead, peek ahead of the current offset using
// readBytesAtOffset below. This keeps readUTF8String neutral with respect
// to the current offset, just like the other readX functions.
const strlen = lenu32.value;
dump([strlen], "string length");
const bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen);
const value = utf8.decode(bytes);
return {
value,
nextIndex: strlen + lenu32.nextIndex
};
}
function readUTF8String() {
var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using
// readBytesAtOffset below. This keeps readUTF8String neutral with respect
// to the current offset, just like the other readX functions.
var strlen = lenu32.value;
dump([strlen], "string length");
var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen);
var value = utf8.decode(bytes);
return {
value: value,
nextIndex: strlen + lenu32.nextIndex
};
}
/**
function readUTF8String() {
var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using
// readBytesAtOffset below. This keeps readUTF8String neutral with respect
// to the current offset, just like the other readX functions.
var strlen = lenu32.value;
dump([strlen], "string length");
var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen);
var value = utf8.decode(bytes);
return {
value: value,
nextIndex: strlen + lenu32.nextIndex
};
}
/**
function readUTF8String() {
var lenu32 = readU32(); // Don't eat any bytes. Instead, peek ahead of the current offset using
// readBytesAtOffset below. This keeps readUTF8String neutral with respect
// to the current offset, just like the other readX functions.
var strlen = lenu32.value;
dump([strlen], "string length");
var bytes = readBytesAtOffset(offset + lenu32.nextIndex, strlen);
var value = utf8.decode(bytes);
return {
value: value,
nextIndex: strlen + lenu32.nextIndex
};
}
/**