Skip to content

Commit

Permalink
Fix return values. (#59)
Browse files Browse the repository at this point in the history
Signed-off-by: John Plevyak <jplevyak@gmail.com>
  • Loading branch information
jplevyak authored Sep 8, 2020
1 parent 6d065f8 commit 0a1fcd4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions src/exports.cc
Original file line number Diff line number Diff line change
Expand Up @@ -385,8 +385,8 @@ Word add_header_map_value(void *raw_context, Word type, Word key_ptr, Word key_s
if (!key || !value) {
return WasmResult::InvalidMemoryAccess;
}
context->addHeaderMapValue(static_cast<WasmHeaderMapType>(type.u64_), key.value(), value.value());
return WasmResult::Ok;
return context->addHeaderMapValue(static_cast<WasmHeaderMapType>(type.u64_), key.value(),
value.value());
}

Word get_header_map_value(void *raw_context, Word type, Word key_ptr, Word key_size,
Expand All @@ -405,7 +405,9 @@ Word get_header_map_value(void *raw_context, Word type, Word key_ptr, Word key_s
if (result != WasmResult::Ok) {
return result;
}
context->wasm()->copyToPointerSize(value, value_ptr_ptr, value_size_ptr);
if (!context->wasm()->copyToPointerSize(value, value_ptr_ptr, value_size_ptr)) {
return WasmResult::InvalidMemoryAccess;
}
return WasmResult::Ok;
}

Expand All @@ -420,9 +422,8 @@ Word replace_header_map_value(void *raw_context, Word type, Word key_ptr, Word k
if (!key || !value) {
return WasmResult::InvalidMemoryAccess;
}
context->replaceHeaderMapValue(static_cast<WasmHeaderMapType>(type.u64_), key.value(),
value.value());
return WasmResult::Ok;
return context->replaceHeaderMapValue(static_cast<WasmHeaderMapType>(type.u64_), key.value(),
value.value());
}

Word remove_header_map_value(void *raw_context, Word type, Word key_ptr, Word key_size) {
Expand All @@ -434,8 +435,7 @@ Word remove_header_map_value(void *raw_context, Word type, Word key_ptr, Word ke
if (!key) {
return WasmResult::InvalidMemoryAccess;
}
context->removeHeaderMapValue(static_cast<WasmHeaderMapType>(type.u64_), key.value());
return WasmResult::Ok;
return context->removeHeaderMapValue(static_cast<WasmHeaderMapType>(type.u64_), key.value());
}

Word get_header_map_pairs(void *raw_context, Word type, Word ptr_ptr, Word size_ptr) {
Expand Down Expand Up @@ -463,8 +463,8 @@ Word set_header_map_pairs(void *raw_context, Word type, Word ptr, Word size) {
if (!data) {
return WasmResult::InvalidMemoryAccess;
}
context->setHeaderMapPairs(static_cast<WasmHeaderMapType>(type.u64_), toPairs(data.value()));
return WasmResult::Ok;
return context->setHeaderMapPairs(static_cast<WasmHeaderMapType>(type.u64_),
toPairs(data.value()));
}

Word get_header_map_size(void *raw_context, Word type, Word result_ptr) {
Expand Down

0 comments on commit 0a1fcd4

Please sign in to comment.