From d4c9d647ee1e213bad5d1d95e1c93e0c39062f57 Mon Sep 17 00:00:00 2001 From: Tatsuya Kawano Date: Mon, 30 Jan 2017 19:17:45 +0800 Subject: [PATCH] Replace cast `as *const i8` with `as *const c_char`. This solves the following type mismatch error in 32-bit ARM systems. error[E0308]: mismatched types key.as_ptr() as *const i8, ^^^^^^^^^^^^^^^^^^^^^^^^^ expected u8, found i8 --- src/db.rs | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/src/db.rs b/src/db.rs index c6cb776..06fdef6 100644 --- a/src/db.rs +++ b/src/db.rs @@ -609,9 +609,9 @@ impl DB { ffi_try!(ffi::rocksdb_merge_cf(self.inner, writeopts.inner, cf.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t, - value.as_ptr() as *const i8, + value.as_ptr() as *const c_char, value.len() as size_t)); Ok(()) } @@ -715,9 +715,9 @@ impl WriteBatch { pub fn put(&mut self, key: &[u8], value: &[u8]) -> Result<(), Error> { unsafe { ffi::rocksdb_writebatch_put(self.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t, - value.as_ptr() as *const i8, + value.as_ptr() as *const c_char, value.len() as size_t); Ok(()) } @@ -731,9 +731,9 @@ impl WriteBatch { unsafe { ffi::rocksdb_writebatch_put_cf(self.inner, cf.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t, - value.as_ptr() as *const i8, + value.as_ptr() as *const c_char, value.len() as size_t); Ok(()) } @@ -742,9 +742,9 @@ impl WriteBatch { pub fn merge(&mut self, key: &[u8], value: &[u8]) -> Result<(), Error> { unsafe { ffi::rocksdb_writebatch_merge(self.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t, - value.as_ptr() as *const i8, + value.as_ptr() as *const c_char, value.len() as size_t); Ok(()) } @@ -758,9 +758,9 @@ impl WriteBatch { unsafe { ffi::rocksdb_writebatch_merge_cf(self.inner, cf.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t, - value.as_ptr() as *const i8, + value.as_ptr() as *const c_char, value.len() as size_t); Ok(()) } @@ -772,7 +772,7 @@ impl WriteBatch { pub fn delete(&mut self, key: &[u8]) -> Result<(), Error> { unsafe { ffi::rocksdb_writebatch_delete(self.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t); Ok(()) } @@ -785,7 +785,7 @@ impl WriteBatch { unsafe { ffi::rocksdb_writebatch_delete_cf(self.inner, cf.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t); Ok(()) } @@ -847,7 +847,7 @@ impl ReadOptions { pub fn set_iterate_upper_bound(&mut self, key: &[u8]) { unsafe { ffi::rocksdb_readoptions_set_iterate_upper_bound(self.inner, - key.as_ptr() as *const i8, + key.as_ptr() as *const c_char, key.len() as size_t); } }