Skip to content

Commit 7b3dbe8

Browse files
committed
fix: stringのぬるバイトを削除
1 parent c77ffd9 commit 7b3dbe8

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

grower-js/src/jsni.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,10 +177,9 @@ class JSNIFunctionCallingSession {
177177
break;
178178
case "string":
179179
const strBytes = new TextEncoder().encode(values[i]);
180-
const strFatPtr = this.imports.alloc(strBytes.length + 1); // 1 byte for null terminator
180+
const strFatPtr = this.imports.alloc(strBytes.length);
181181
const strPtr = Number(strFatPtr & BigInt(0xffffffff));
182182
this.arr.set(strBytes, strPtr);
183-
this.arr[strPtr + strBytes.length] = 0; // null terminator
184183
this.view.setUint32(ptr + i * 16, Number(strFatPtr >> BigInt(32)), true);
185184
this.view.setInt32(ptr + i * 16 + 8, JSNIKind.String, true);
186185
break;

0 commit comments

Comments
 (0)