mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Runned FMT
This commit is contained in:
parent
69dba49884
commit
ea1efd1ce1
@ -60,7 +60,9 @@ impl PluginModule {
|
||||
Ok(e) => e,
|
||||
Err(e) => return Some(Err(e)),
|
||||
};
|
||||
match execute_raw(&instance, &func, &request.bytes).map_err(PluginModuleError::RunFunction) {
|
||||
match execute_raw(&instance, &func, &request.bytes)
|
||||
.map_err(PluginModuleError::RunFunction)
|
||||
{
|
||||
Ok(e) => e,
|
||||
Err(e) => return Some(Err(e)),
|
||||
}
|
||||
@ -102,10 +104,12 @@ fn execute_raw(
|
||||
// This reserves space for the buffer
|
||||
let len = bytes.len();
|
||||
let start = {
|
||||
let memory_pos = reserve_wasm_memory_buffer(len,instance).expect("Fatal error while allocating memory for a plugin! Closing server...") as usize;
|
||||
let memory_pos = reserve_wasm_memory_buffer(len, instance)
|
||||
.expect("Fatal error while allocating memory for a plugin! Closing server...")
|
||||
as usize;
|
||||
let memory = instance.context().memory(0);
|
||||
let view = memory.view::<u8>();
|
||||
for (cell, byte) in view[memory_pos..memory_pos+len].iter().zip(bytes.iter()) {
|
||||
for (cell, byte) in view[memory_pos..memory_pos + len].iter().zip(bytes.iter()) {
|
||||
cell.set(*byte)
|
||||
}
|
||||
function.call(memory_pos as i32, len as u32)? as usize
|
||||
|
Loading…
Reference in New Issue
Block a user