mirror of
https://github.com/odin-lang/Odin.git
synced 2026-02-14 15:23:15 +00:00
Merge pull request #5245 from TheTophatDemon/fix-odin-js-loadcstring
Fix odin.js loadCstring to use pointer address correctly.
This commit is contained in:
@@ -110,16 +110,12 @@ class WasmMemoryInterface {
|
||||
}
|
||||
|
||||
loadCstring(ptr) {
|
||||
return this.loadCstringDirect(this.loadPtr(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); }
|
||||
|
||||
Reference in New Issue
Block a user