File tree Expand file tree Collapse file tree 2 files changed +14
-5
lines changed
Expand file tree Collapse file tree 2 files changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -6,7 +6,7 @@ mod driver;
66#[ cfg( feature = "object_store" ) ]
77pub mod object_store;
88mod read;
9- #[ cfg( all ( unix , not( target_arch = "wasm32" ) ) ) ]
9+ #[ cfg( not( target_arch = "wasm32" ) ) ]
1010mod std_file;
1111
1212pub ( crate ) use driver:: * ;
Original file line number Diff line number Diff line change @@ -82,10 +82,19 @@ impl ReadSource for FileIoSource {
8282 let offset = req. offset ( ) ;
8383 let mut buffer = ByteBufferMut :: with_capacity_aligned ( len, req. alignment ( ) ) ;
8484 unsafe { buffer. set_len ( len) } ;
85- req. resolve ( match file. read_exact_at ( & mut buffer, offset) {
86- Ok ( ( ) ) => Ok ( buffer. freeze ( ) ) ,
87- Err ( e) => Err ( VortexError :: from ( e) ) ,
88- } )
85+
86+ #[ cfg( unix) ]
87+ let buffer_res = file. read_exact_at ( & mut buffer, offset) ;
88+ #[ cfg( not( unix) ) ]
89+ let buffer_res = file
90+ . seek ( io:: SeekFrom :: Start ( offset) )
91+ . and_then ( |_| file. read_exact ( & mut buffer) ) ;
92+
93+ req. resolve (
94+ buffer_res
95+ . map ( |_| buffer. freeze ( ) )
96+ . map_err ( VortexError :: from) ,
97+ )
8998 }
9099 } )
91100 } )
You can’t perform that action at this time.
0 commit comments