From b3ae5fb67afa51eb1fef1b19d46ba7d747452f07 Mon Sep 17 00:00:00 2001 From: Tyler Neely Date: Wed, 1 Jul 2015 00:25:41 -0700 Subject: [PATCH] Fix breakage due to transmutation changes. --- src/merge_operator.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/merge_operator.rs b/src/merge_operator.rs index 4784390..35006d6 100644 --- a/src/merge_operator.rs +++ b/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