Changes Read to receive uint64 byte count. (#2085)
Signed-off-by: Nuno Cruces <ncruces@users.noreply.github.com>
This commit is contained in:
@@ -91,7 +91,7 @@ func main() {
|
||||
defer deallocate.Call(ctx, uint64(greetingPtr), uint64(greetingSize))
|
||||
|
||||
// The pointer is a linear memory offset, which is where we write the name.
|
||||
if bytes, ok := mod.Memory().Read(greetingPtr, greetingSize); !ok {
|
||||
if bytes, ok := mod.Memory().Read(greetingPtr, uint64(greetingSize)); !ok {
|
||||
log.Panicf("Memory.Read(%d, %d) out of range of memory size %d",
|
||||
greetingPtr, greetingSize, mod.Memory().Size())
|
||||
} else {
|
||||
@@ -100,7 +100,7 @@ func main() {
|
||||
}
|
||||
|
||||
func logString(ctx context.Context, m api.Module, offset, byteCount uint32) {
|
||||
buf, ok := m.Memory().Read(offset, byteCount)
|
||||
buf, ok := m.Memory().Read(offset, uint64(byteCount))
|
||||
if !ok {
|
||||
log.Panicf("Memory.Read(%d, %d) out of range", offset, byteCount)
|
||||
}
|
||||
|
||||
@@ -106,7 +106,7 @@ func main() {
|
||||
}
|
||||
|
||||
// The pointer is a linear memory offset, which is where we write the name.
|
||||
if bytes, ok := mod.Memory().Read(greetingPtr, greetingSize); !ok {
|
||||
if bytes, ok := mod.Memory().Read(greetingPtr, uint64(greetingSize)); !ok {
|
||||
log.Panicf("Memory.Read(%d, %d) out of range of memory size %d",
|
||||
greetingPtr, greetingSize, mod.Memory().Size())
|
||||
} else {
|
||||
@@ -115,7 +115,7 @@ func main() {
|
||||
}
|
||||
|
||||
func logString(_ context.Context, m api.Module, offset, byteCount uint32) {
|
||||
buf, ok := m.Memory().Read(offset, byteCount)
|
||||
buf, ok := m.Memory().Read(offset, uint64(byteCount))
|
||||
if !ok {
|
||||
log.Panicf("Memory.Read(%d, %d) out of range", offset, byteCount)
|
||||
}
|
||||
|
||||
@@ -98,7 +98,7 @@ func run() error {
|
||||
greetingPtr := uint32(ptrSize[0] >> 32)
|
||||
greetingSize := uint32(ptrSize[0])
|
||||
// The pointer is a linear memory offset, which is where we write the name.
|
||||
if bytes, ok := mod.Memory().Read(greetingPtr, greetingSize); !ok {
|
||||
if bytes, ok := mod.Memory().Read(greetingPtr, uint64(greetingSize)); !ok {
|
||||
return fmt.Errorf("Memory.Read(%d, %d) out of range of memory size %d",
|
||||
greetingPtr, greetingSize, mod.Memory().Size())
|
||||
} else {
|
||||
@@ -109,7 +109,7 @@ func run() error {
|
||||
}
|
||||
|
||||
func logString(_ context.Context, m api.Module, offset, byteCount uint32) {
|
||||
buf, ok := m.Memory().Read(offset, byteCount)
|
||||
buf, ok := m.Memory().Read(offset, uint64(byteCount))
|
||||
if !ok {
|
||||
log.Panicf("Memory.Read(%d, %d) out of range", offset, byteCount)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user