@@ -26,7 +26,7 @@ use crate::{
2626 WriteBatch , WriteOptions , DEFAULT_COLUMN_FAMILY_NAME ,
2727} ;
2828
29- use libc:: { self , c_char, c_int, c_void, size_t} ;
29+ use libc:: { self , c_char, c_int, c_uchar , c_void, size_t} ;
3030use std:: collections:: BTreeMap ;
3131use std:: ffi:: { CStr , CString } ;
3232use std:: fmt;
@@ -638,22 +638,22 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
638638 error_if_log_file_exist,
639639 } => ffi_try ! ( ffi:: rocksdb_open_for_read_only(
640640 opts. inner,
641- cpath. as_ptr( ) as * const _ ,
642- u8 :: from( error_if_log_file_exist) ,
641+ cpath. as_ptr( ) ,
642+ c_uchar :: from( error_if_log_file_exist) ,
643643 ) ) ,
644644 AccessType :: ReadWrite => {
645- ffi_try ! ( ffi:: rocksdb_open( opts. inner, cpath. as_ptr( ) as * const _ ) )
645+ ffi_try ! ( ffi:: rocksdb_open( opts. inner, cpath. as_ptr( ) ) )
646646 }
647647 AccessType :: Secondary { secondary_path } => {
648648 ffi_try ! ( ffi:: rocksdb_open_as_secondary(
649649 opts. inner,
650- cpath. as_ptr( ) as * const _ ,
651- to_cpath( secondary_path) ?. as_ptr( ) as * const _ ,
650+ cpath. as_ptr( ) ,
651+ to_cpath( secondary_path) ?. as_ptr( ) ,
652652 ) )
653653 }
654654 AccessType :: WithTTL { ttl } => ffi_try ! ( ffi:: rocksdb_open_with_ttl(
655655 opts. inner,
656- cpath. as_ptr( ) as * const _ ,
656+ cpath. as_ptr( ) ,
657657 ttl. as_secs( ) as c_int,
658658 ) ) ,
659659 }
@@ -682,7 +682,7 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
682682 cfnames. as_ptr( ) ,
683683 cfopts. as_ptr( ) ,
684684 cfhandles. as_mut_ptr( ) ,
685- u8 :: from( error_if_log_file_exist) ,
685+ c_uchar :: from( error_if_log_file_exist) ,
686686 ) ) ,
687687 AccessType :: ReadWrite => ffi_try ! ( ffi:: rocksdb_open_column_families(
688688 opts. inner,
@@ -695,23 +695,24 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
695695 AccessType :: Secondary { secondary_path } => {
696696 ffi_try ! ( ffi:: rocksdb_open_as_secondary_column_families(
697697 opts. inner,
698- cpath. as_ptr( ) as * const _ ,
699- to_cpath( secondary_path) ?. as_ptr( ) as * const _ ,
698+ cpath. as_ptr( ) ,
699+ to_cpath( secondary_path) ?. as_ptr( ) ,
700700 cfs_v. len( ) as c_int,
701701 cfnames. as_ptr( ) ,
702702 cfopts. as_ptr( ) ,
703703 cfhandles. as_mut_ptr( ) ,
704704 ) )
705705 }
706706 AccessType :: WithTTL { ttl } => {
707+ let ttls_v = vec ! [ ttl. as_secs( ) as c_int; cfs_v. len( ) ] ;
707708 ffi_try ! ( ffi:: rocksdb_open_column_families_with_ttl(
708709 opts. inner,
709710 cpath. as_ptr( ) ,
710711 cfs_v. len( ) as c_int,
711712 cfnames. as_ptr( ) ,
712713 cfopts. as_ptr( ) ,
713714 cfhandles. as_mut_ptr( ) ,
714- & ( ttl . as_secs ( ) as c_int ) as * const _ ,
715+ ttls_v . as_ptr ( ) ,
715716 ) )
716717 }
717718 }
@@ -726,7 +727,7 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
726727 unsafe {
727728 let ptr = ffi_try ! ( ffi:: rocksdb_list_column_families(
728729 opts. inner,
729- cpath. as_ptr( ) as * const _ ,
730+ cpath. as_ptr( ) ,
730731 & mut length,
731732 ) ) ;
732733
@@ -763,7 +764,7 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
763764 /// the data to disk.
764765 pub fn flush_wal ( & self , sync : bool ) -> Result < ( ) , Error > {
765766 unsafe {
766- ffi_try ! ( ffi:: rocksdb_flush_wal( self . inner, u8 :: from( sync) ) ) ;
767+ ffi_try ! ( ffi:: rocksdb_flush_wal( self . inner, c_uchar :: from( sync) ) ) ;
767768 }
768769 Ok ( ( ) )
769770 }
@@ -1975,7 +1976,7 @@ impl<T: ThreadMode> DBWithThreadMode<T> {
19751976 /// Request stopping background work, if wait is true wait until it's done.
19761977 pub fn cancel_all_background_work ( & self , wait : bool ) {
19771978 unsafe {
1978- ffi:: rocksdb_cancel_all_background_work ( self . inner , u8 :: from ( wait) ) ;
1979+ ffi:: rocksdb_cancel_all_background_work ( self . inner , c_uchar :: from ( wait) ) ;
19791980 }
19801981 }
19811982
0 commit comments