Fix breakage due to transmutation changes.

master
Tyler Neely 10 years ago
parent 00df70b201
commit b3ae5fb67a
  1. 8
      src/merge_operator.rs

@ -56,9 +56,9 @@ pub extern "C" fn full_merge_callback(
&mut MergeOperands::new(operands_list,
operands_list_len,
num_operands);
let key: &[u8] = mem::transmute(slice::from_raw_parts(&raw_key, key_len as usize));
let oldval: &[u8] = mem::transmute(slice::from_raw_parts(&existing_value,
existing_value_len as usize));
let key: &[u8] = slice::from_raw_parts(raw_key as *const u8, key_len as usize);
let oldval: &[u8] = slice::from_raw_parts(existing_value as *const u8,
existing_value_len as usize);
let mut result =
(cb.merge_fn)(key, Some(oldval), operands);
result.shrink_to_fit();
@ -83,7 +83,7 @@ pub extern "C" fn partial_merge_callback(
let operands = &mut MergeOperands::new(operands_list,
operands_list_len,
num_operands);
let key: &[u8] = mem::transmute(slice::from_raw_parts(&raw_key, key_len as usize));
let key: &[u8] = slice::from_raw_parts(raw_key as *const u8, key_len as usize);
let mut result = (cb.merge_fn)(key, None, operands);
result.shrink_to_fit();
//TODO(tan) investigate zero-copy techniques to improve performance

Loading…
Cancel
Save