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
master
Tatsuya Kawano 8 years ago
parent da7590e575
commit d4c9d647ee
  1. 26
      src/db.rs

@ -609,9 +609,9 @@ impl DB {
ffi_try!(ffi::rocksdb_merge_cf(self.inner, ffi_try!(ffi::rocksdb_merge_cf(self.inner,
writeopts.inner, writeopts.inner,
cf.inner, cf.inner,
key.as_ptr() as *const i8, key.as_ptr() as *const c_char,
key.len() as size_t, key.len() as size_t,
value.as_ptr() as *const i8, value.as_ptr() as *const c_char,
value.len() as size_t)); value.len() as size_t));
Ok(()) Ok(())
} }
@ -715,9 +715,9 @@ impl WriteBatch {
pub fn put(&mut self, key: &[u8], value: &[u8]) -> Result<(), Error> { pub fn put(&mut self, key: &[u8], value: &[u8]) -> Result<(), Error> {
unsafe { unsafe {
ffi::rocksdb_writebatch_put(self.inner, ffi::rocksdb_writebatch_put(self.inner,
key.as_ptr() as *const i8, key.as_ptr() as *const c_char,
key.len() as size_t, key.len() as size_t,
value.as_ptr() as *const i8, value.as_ptr() as *const c_char,
value.len() as size_t); value.len() as size_t);
Ok(()) Ok(())
} }
@ -731,9 +731,9 @@ impl WriteBatch {
unsafe { unsafe {
ffi::rocksdb_writebatch_put_cf(self.inner, ffi::rocksdb_writebatch_put_cf(self.inner,
cf.inner, cf.inner,
key.as_ptr() as *const i8, key.as_ptr() as *const c_char,
key.len() as size_t, key.len() as size_t,
value.as_ptr() as *const i8, value.as_ptr() as *const c_char,
value.len() as size_t); value.len() as size_t);
Ok(()) Ok(())
} }
@ -742,9 +742,9 @@ impl WriteBatch {
pub fn merge(&mut self, key: &[u8], value: &[u8]) -> Result<(), Error> { pub fn merge(&mut self, key: &[u8], value: &[u8]) -> Result<(), Error> {
unsafe { unsafe {
ffi::rocksdb_writebatch_merge(self.inner, ffi::rocksdb_writebatch_merge(self.inner,
key.as_ptr() as *const i8, key.as_ptr() as *const c_char,
key.len() as size_t, key.len() as size_t,
value.as_ptr() as *const i8, value.as_ptr() as *const c_char,
value.len() as size_t); value.len() as size_t);
Ok(()) Ok(())
} }
@ -758,9 +758,9 @@ impl WriteBatch {
unsafe { unsafe {
ffi::rocksdb_writebatch_merge_cf(self.inner, ffi::rocksdb_writebatch_merge_cf(self.inner,
cf.inner, cf.inner,
key.as_ptr() as *const i8, key.as_ptr() as *const c_char,
key.len() as size_t, key.len() as size_t,
value.as_ptr() as *const i8, value.as_ptr() as *const c_char,
value.len() as size_t); value.len() as size_t);
Ok(()) Ok(())
} }
@ -772,7 +772,7 @@ impl WriteBatch {
pub fn delete(&mut self, key: &[u8]) -> Result<(), Error> { pub fn delete(&mut self, key: &[u8]) -> Result<(), Error> {
unsafe { unsafe {
ffi::rocksdb_writebatch_delete(self.inner, ffi::rocksdb_writebatch_delete(self.inner,
key.as_ptr() as *const i8, key.as_ptr() as *const c_char,
key.len() as size_t); key.len() as size_t);
Ok(()) Ok(())
} }
@ -785,7 +785,7 @@ impl WriteBatch {
unsafe { unsafe {
ffi::rocksdb_writebatch_delete_cf(self.inner, ffi::rocksdb_writebatch_delete_cf(self.inner,
cf.inner, cf.inner,
key.as_ptr() as *const i8, key.as_ptr() as *const c_char,
key.len() as size_t); key.len() as size_t);
Ok(()) Ok(())
} }
@ -847,7 +847,7 @@ impl ReadOptions {
pub fn set_iterate_upper_bound(&mut self, key: &[u8]) { pub fn set_iterate_upper_bound(&mut self, key: &[u8]) {
unsafe { unsafe {
ffi::rocksdb_readoptions_set_iterate_upper_bound(self.inner, 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); key.len() as size_t);
} }
} }

Loading…
Cancel
Save