1- use crate :: ffi:: OsString ;
1+ use crate :: ffi:: { OsString , c_char } ;
22use crate :: fmt;
33use crate :: fs:: TryLockError ;
44use crate :: hash:: Hash ;
@@ -342,9 +342,9 @@ impl File {
342342 }
343343
344344 pub fn read ( & self , buf : & mut [ u8 ] ) -> io:: Result < usize > {
345- let len = buf. len ( ) as _ ;
345+ let len = buf. len ( ) as u32 ;
346346 let buf_ptr = buf. as_mut_ptr ( ) ;
347- let read = unsafe { vex_sdk:: vexFileRead ( buf_ptr. cast ( ) , 1 , len, self . fd . 0 ) } ;
347+ let read = unsafe { vex_sdk:: vexFileRead ( buf_ptr. cast :: < c_char > ( ) , 1 , len, self . fd . 0 ) } ;
348348
349349 if read < 0 {
350350 Err ( io:: const_error!( io:: ErrorKind :: Other , "Could not read from file" ) )
@@ -367,10 +367,11 @@ impl File {
367367 }
368368
369369 pub fn write ( & self , buf : & [ u8 ] ) -> io:: Result < usize > {
370- let len = buf. len ( ) ;
370+ let len = buf. len ( ) as u32 ;
371371 let buf_ptr = buf. as_ptr ( ) ;
372- let written =
373- unsafe { vex_sdk:: vexFileWrite ( buf_ptr. cast_mut ( ) . cast ( ) , 1 , len as _ , self . fd . 0 ) } ;
372+ let written = unsafe {
373+ vex_sdk:: vexFileWrite ( buf_ptr. cast_mut ( ) . cast :: < c_char > ( ) , 1 , len, self . fd . 0 )
374+ } ;
374375
375376 if written < 0 {
376377 Err ( io:: const_error!( io:: ErrorKind :: Other , "Could not write to file" ) )
@@ -516,9 +517,12 @@ pub fn lstat(p: &Path) -> io::Result<FileAttr> {
516517 stat ( p)
517518}
518519
520+ // NOTE: Cannot use `copy` from `common` here, since we have no support
521+ // for `File::set_permissions`.
519522pub fn copy ( from : & Path , to : & Path ) -> io:: Result < u64 > {
520523 use crate :: fs:: File ;
521524
525+ // If `from` is a directory, this call should fail.
522526 let mut reader = File :: open ( from) ?;
523527 let mut writer = File :: create ( to) ?;
524528
0 commit comments