From 9d223e178b02cadb1e59b3f4d938c8b6221daf1d Mon Sep 17 00:00:00 2001 From: Alexander Lunsford Date: Fri, 30 May 2025 19:50:34 -0500 Subject: [PATCH 1/2] Fix odin.js loadCstring to use pointer address correctly. --- core/sys/wasm/js/odin.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/sys/wasm/js/odin.js b/core/sys/wasm/js/odin.js index d5faa5210..1bc0cef4f 100644 --- a/core/sys/wasm/js/odin.js +++ b/core/sys/wasm/js/odin.js @@ -110,7 +110,7 @@ class WasmMemoryInterface { } loadCstring(ptr) { - return this.loadCstringDirect(this.loadPtr(ptr)); + return this.loadCstringDirect(ptr); } loadCstringDirect(start) { From edba218a7c25c39432040176f4c7ea78a9d72958 Mon Sep 17 00:00:00 2001 From: Alexander Lunsford Date: Fri, 30 May 2025 20:02:08 -0500 Subject: [PATCH 2/2] Simplified function call to loadCstringDirect --- core/sys/wasm/js/odin.js | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/core/sys/wasm/js/odin.js b/core/sys/wasm/js/odin.js index 1bc0cef4f..37a57a59d 100644 --- a/core/sys/wasm/js/odin.js +++ b/core/sys/wasm/js/odin.js @@ -110,16 +110,12 @@ class WasmMemoryInterface { } loadCstring(ptr) { - return this.loadCstringDirect(ptr); - } - - loadCstringDirect(start) { - if (start == 0) { + if (ptr == 0) { return null; } let len = 0; - for (; this.mem.getUint8(start+len) != 0; len += 1) {} - return this.loadString(start, len); + for (; this.mem.getUint8(ptr+len) != 0; len += 1) {} + return this.loadString(ptr, len); } storeU8(addr, value) { this.mem.setUint8 (addr, value); }