Skip to content

Commit 914c241

Browse files
committed
use stringToUTF8() not writeAsciiToMemory()
1 parent 2d6fae8 commit 914c241

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

src/utils/parseArgs.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
module.exports = (Core, args) => {
22
const argsPtr = Core._malloc(args.length * Uint32Array.BYTES_PER_ELEMENT);
33
args.forEach((s, idx) => {
4-
const buf = Core._malloc(s.length + 1);
5-
Core.writeAsciiToMemory(s, buf);
4+
const sz = s.length*4 + 1;
5+
const buf = Core._malloc(sz);
6+
Core.stringToUTF8(s, buf, sz);
67
Core.setValue(argsPtr + (Uint32Array.BYTES_PER_ELEMENT * idx), buf, 'i32');
78
});
89
return [args.length, argsPtr];

0 commit comments

Comments
 (0)