1- // Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+ // Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
22// file at the top-level directory of this distribution and at
33// http://rust-lang.org/COPYRIGHT.
44//
@@ -27,8 +27,8 @@ use io::{IoResult, retry};
2727#[ cfg( windows) ] use std:: str;
2828
2929pub fn keep_going ( data : & [ u8 ] , f : |* u8 , uint| -> i64) -> i64 {
30- #[ cfg( windows) ] static eintr : int = 0 ; // doesn't matter
31- #[ cfg( not( windows) ) ] static eintr : int = libc:: EINTR as int ;
30+ #[ cfg( windows) ] static EINTR : int = 0 ; // doesn't matter
31+ #[ cfg( not( windows) ) ] static EINTR : int = libc:: EINTR as int ;
3232
3333 let origamt = data. len ( ) ;
3434 let mut data = data. as_ptr ( ) ;
@@ -37,9 +37,9 @@ pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
3737 let mut ret;
3838 loop {
3939 ret = f ( data, amt) ;
40- if cfg ! ( windows) { break } // windows has no eintr
41- // if we get an eintr , then try again
42- if ret != -1 || os:: errno ( ) as int != eintr { break }
40+ if cfg ! ( windows) { break } // windows has no EINTR
41+ // if we get an EINTR , then try again
42+ if ret != -1 || os:: errno ( ) as int != EINTR { break }
4343 }
4444 if ret == 0 {
4545 break
@@ -53,6 +53,7 @@ pub fn keep_going(data: &[u8], f: |*u8, uint| -> i64) -> i64 {
5353 return ( origamt - amt) as i64 ;
5454}
5555
56+ #[ allow( non_camel_case_types) ]
5657pub type fd_t = libc:: c_int ;
5758
5859pub struct FileDesc {
@@ -77,12 +78,12 @@ impl FileDesc {
7778 // native::io wanting to use them is forced to have all the
7879 // rtio traits in scope
7980 pub fn inner_read ( & mut self , buf : & mut [ u8 ] ) -> Result < uint , IoError > {
80- #[ cfg( windows) ] type rlen = libc:: c_uint ;
81- #[ cfg( not( windows) ) ] type rlen = libc:: size_t ;
81+ #[ cfg( windows) ] type RLen = libc:: c_uint ;
82+ #[ cfg( not( windows) ) ] type RLen = libc:: size_t ;
8283 let ret = retry ( || unsafe {
8384 libc:: read ( self . fd ,
8485 buf. as_ptr ( ) as * mut libc:: c_void ,
85- buf. len ( ) as rlen ) as libc:: c_int
86+ buf. len ( ) as RLen ) as libc:: c_int
8687 } ) ;
8788 if ret == 0 {
8889 Err ( io:: standard_error ( io:: EndOfFile ) )
@@ -93,11 +94,11 @@ impl FileDesc {
9394 }
9495 }
9596 pub fn inner_write ( & mut self , buf : & [ u8 ] ) -> Result < ( ) , IoError > {
96- #[ cfg( windows) ] type wlen = libc:: c_uint ;
97- #[ cfg( not( windows) ) ] type wlen = libc:: size_t ;
97+ #[ cfg( windows) ] type WLen = libc:: c_uint ;
98+ #[ cfg( not( windows) ) ] type WLen = libc:: size_t ;
9899 let ret = keep_going ( buf, |buf, len| {
99100 unsafe {
100- libc:: write ( self . fd , buf as * libc:: c_void , len as wlen ) as i64
101+ libc:: write ( self . fd , buf as * libc:: c_void , len as WLen ) as i64
101102 }
102103 } ) ;
103104 if ret < 0 {
@@ -782,7 +783,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
782783 path : Path :: new ( path) ,
783784 size : stat. st_size as u64 ,
784785 kind : kind,
785- perm : ( stat. st_mode ) as io:: FilePermission & io:: AllPermissions ,
786+ perm : ( stat. st_mode ) as io:: FilePermission & io:: ALL_PERMISSIONS ,
786787 created : stat. st_ctime as u64 ,
787788 modified : stat. st_mtime as u64 ,
788789 accessed : stat. st_atime as u64 ,
@@ -831,7 +832,7 @@ fn mkstat(stat: &libc::stat, path: &CString) -> io::FileStat {
831832 path : Path :: new ( path) ,
832833 size : stat. st_size as u64 ,
833834 kind : kind,
834- perm : ( stat. st_mode ) as io:: FilePermission & io:: AllPermissions ,
835+ perm : ( stat. st_mode ) as io:: FilePermission & io:: ALL_PERMISSIONS ,
835836 created : mktime ( stat. st_ctime as u64 , stat. st_ctime_nsec as u64 ) ,
836837 modified : mktime ( stat. st_mtime as u64 , stat. st_mtime_nsec as u64 ) ,
837838 accessed : mktime ( stat. st_atime as u64 , stat. st_atime_nsec as u64 ) ,
0 commit comments