readWASIComponentCanonicalStringRecord function

String readWASIComponentCanonicalStringRecord(
  1. Memory memory,
  2. int pointer,
  3. WASIComponentCanonicalStringEncoding encoding
)

Reads a canonical (ptr, len) string record from memory.

Implementation

String readWASIComponentCanonicalStringRecord(
  wasm.Memory memory,
  int pointer,
  WASIComponentCanonicalStringEncoding encoding,
) {
  checkWASIComponentCanonicalStringRecordRange(memory, pointer, 1);
  final data = ByteData.view(memory.buffer);
  final stringPointer = data.getUint32(pointer, Endian.little);
  final canonicalLength = data.getUint32(pointer + 4, Endian.little);
  return readWASIComponentCanonicalString(
    memory,
    stringPointer,
    canonicalLength,
    encoding,
  );
}