Merge pull request #7 from pepyakin/fix-wrapper

Fix examples/tests with proper addressing further casts
This commit is contained in:
Sergey Pepyakin 2018-01-23 17:46:18 +03:00 committed by GitHub
commit 55342dceaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 4 deletions

View File

@ -90,12 +90,12 @@ impl Externals for TestHost {
Ok(Some(result)) Ok(Some(result))
} }
ERR_FUNC_INDEX => { ERR_FUNC_INDEX => {
let error_code = args.nth::<i32>(0)? as u32; let error_code: u32 = args.nth(0)?;
let error = HostErrorWithCode { error_code }; let error = HostErrorWithCode { error_code };
Err(Error::Host(Box::new(error))) Err(Error::Host(Box::new(error)))
} }
INC_MEM_FUNC_INDEX => { INC_MEM_FUNC_INDEX => {
let ptr = args.nth::<i32>(0)? as u32; let ptr: u32 = args.nth(0)?;
let memory = self.memory.as_ref().expect( let memory = self.memory.as_ref().expect(
"Function 'inc_mem' expects attached memory", "Function 'inc_mem' expects attached memory",
@ -108,7 +108,7 @@ impl Externals for TestHost {
Ok(None) Ok(None)
} }
GET_MEM_FUNC_INDEX => { GET_MEM_FUNC_INDEX => {
let ptr = args.nth::<i32>(0)? as u32; let ptr: u32 = args.nth(0)?;
let memory = self.memory.as_ref().expect( let memory = self.memory.as_ref().expect(
"Function 'get_mem' expects attached memory", "Function 'get_mem' expects attached memory",
@ -466,7 +466,7 @@ fn defer_providing_externals() {
) -> Result<Option<RuntimeValue>, Error> { ) -> Result<Option<RuntimeValue>, Error> {
match index { match index {
INC_FUNC_INDEX => { INC_FUNC_INDEX => {
let a = args.nth::<i32>(0)? as u32; let a = args.nth::<u32>(0)?;
*self.acc += a; *self.acc += a;
Ok(None) Ok(None)
} }