mirror of
https://github.com/fluencelabs/wasmer
synced 2024-12-14 14:45:40 +00:00
assign to the protect enum (#153)
This commit is contained in:
parent
83df3ad35f
commit
bca702794c
@ -47,7 +47,7 @@ impl Memory {
|
|||||||
range: impl RangeBounds<usize>,
|
range: impl RangeBounds<usize>,
|
||||||
protect: Protect,
|
protect: Protect,
|
||||||
) -> Result<(), String> {
|
) -> Result<(), String> {
|
||||||
let protect = protect.to_protect_const();
|
let protect_const = protect.to_protect_const();
|
||||||
|
|
||||||
let range_start = match range.start_bound() {
|
let range_start = match range.start_bound() {
|
||||||
Bound::Included(start) => *start,
|
Bound::Included(start) => *start,
|
||||||
@ -69,12 +69,12 @@ impl Memory {
|
|||||||
assert!(size <= self.size);
|
assert!(size <= self.size);
|
||||||
|
|
||||||
// Commit the virtual memory.
|
// Commit the virtual memory.
|
||||||
let ptr = VirtualAlloc(start as _, size, MEM_COMMIT, protect);
|
let ptr = VirtualAlloc(start as _, size, MEM_COMMIT, protect_const);
|
||||||
|
|
||||||
if ptr.is_null() {
|
if ptr.is_null() {
|
||||||
Err("unable to protect memory".to_string())
|
Err("unable to protect memory".to_string())
|
||||||
} else {
|
} else {
|
||||||
self.protection = protection;
|
self.protection = protect;
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user