diff options
| author | Alex Crichton <alex@alexcrichton.com> | 2015-03-25 17:06:52 -0700 |
|---|---|---|
| committer | Alex Crichton <alex@alexcrichton.com> | 2015-03-26 12:10:22 -0700 |
| commit | 43bfaa4a336095eb5697fb2df50909fd3c72ed14 (patch) | |
| tree | e10610e1ce9811c89e1291b786d7a49b63ee02d9 /src/libstd/old_io | |
| parent | 54f16b818b58f6d6e81891b041fc751986e75155 (diff) | |
| download | rust-43bfaa4a336095eb5697fb2df50909fd3c72ed14.tar.gz rust-43bfaa4a336095eb5697fb2df50909fd3c72ed14.zip | |
Mass rename uint/int to usize/isize
Now that support has been removed, all lingering use cases are renamed.
Diffstat (limited to 'src/libstd/old_io')
| -rw-r--r-- | src/libstd/old_io/buffered.rs | 30 | ||||
| -rw-r--r-- | src/libstd/old_io/comm_adapters.rs | 6 | ||||
| -rw-r--r-- | src/libstd/old_io/extensions.rs | 30 | ||||
| -rw-r--r-- | src/libstd/old_io/fs.rs | 18 | ||||
| -rw-r--r-- | src/libstd/old_io/mem.rs | 32 | ||||
| -rw-r--r-- | src/libstd/old_io/mod.rs | 86 | ||||
| -rw-r--r-- | src/libstd/old_io/net/addrinfo.rs | 8 | ||||
| -rw-r--r-- | src/libstd/old_io/net/ip.rs | 4 | ||||
| -rw-r--r-- | src/libstd/old_io/net/pipe.rs | 2 | ||||
| -rw-r--r-- | src/libstd/old_io/net/tcp.rs | 28 | ||||
| -rw-r--r-- | src/libstd/old_io/net/udp.rs | 6 | ||||
| -rw-r--r-- | src/libstd/old_io/pipe.rs | 2 | ||||
| -rw-r--r-- | src/libstd/old_io/process.rs | 36 | ||||
| -rw-r--r-- | src/libstd/old_io/result.rs | 2 | ||||
| -rw-r--r-- | src/libstd/old_io/stdio.rs | 18 | ||||
| -rw-r--r-- | src/libstd/old_io/tempfile.rs | 2 | ||||
| -rw-r--r-- | src/libstd/old_io/util.rs | 28 |
17 files changed, 169 insertions, 169 deletions
diff --git a/src/libstd/old_io/buffered.rs b/src/libstd/old_io/buffered.rs index 9a9d421dfe1..085ec78b565 100644 --- a/src/libstd/old_io/buffered.rs +++ b/src/libstd/old_io/buffered.rs @@ -49,8 +49,8 @@ use vec::Vec; pub struct BufferedReader<R> { inner: R, buf: Vec<u8>, - pos: uint, - cap: uint, + pos: usize, + cap: usize, } #[stable(feature = "rust1", since = "1.0.0")] @@ -63,7 +63,7 @@ impl<R> fmt::Debug for BufferedReader<R> where R: fmt::Debug { impl<R: Reader> BufferedReader<R> { /// Creates a new `BufferedReader` with the specified buffer capacity - pub fn with_capacity(cap: uint, inner: R) -> BufferedReader<R> { + pub fn with_capacity(cap: usize, inner: R) -> BufferedReader<R> { BufferedReader { inner: inner, // We can't use the same trick here as we do for BufferedWriter, @@ -104,14 +104,14 @@ impl<R: Reader> Buffer for BufferedReader<R> { Ok(&self.buf[self.pos..self.cap]) } - fn consume(&mut self, amt: uint) { + fn consume(&mut self, amt: usize) { self.pos += amt; assert!(self.pos <= self.cap); } } impl<R: Reader> Reader for BufferedReader<R> { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { if self.pos == self.cap && buf.len() >= self.buf.len() { return self.inner.read(buf); } @@ -151,7 +151,7 @@ impl<R: Reader> Reader for BufferedReader<R> { pub struct BufferedWriter<W: Writer> { inner: Option<W>, buf: Vec<u8>, - pos: uint + pos: usize } #[stable(feature = "rust1", since = "1.0.0")] @@ -164,7 +164,7 @@ impl<W: Writer> fmt::Debug for BufferedWriter<W> where W: fmt::Debug { impl<W: Writer> BufferedWriter<W> { /// Creates a new `BufferedWriter` with the specified buffer capacity - pub fn with_capacity(cap: uint, inner: W) -> BufferedWriter<W> { + pub fn with_capacity(cap: usize, inner: W) -> BufferedWriter<W> { // It's *much* faster to create an uninitialized buffer than it is to // fill everything in with 0. This buffer is entirely an implementation // detail and is never exposed, so we're safe to not initialize @@ -309,7 +309,7 @@ impl<W: Writer> InternalBufferedWriter<W> { } impl<W: Reader + Writer> Reader for InternalBufferedWriter<W> { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.get_mut().inner.as_mut().unwrap().read(buf) } } @@ -362,7 +362,7 @@ impl<S: Writer> fmt::Debug for BufferedStream<S> where S: fmt::Debug { impl<S: Stream> BufferedStream<S> { /// Creates a new buffered stream with explicitly listed capacities for the /// reader/writer buffer. - pub fn with_capacities(reader_cap: uint, writer_cap: uint, inner: S) + pub fn with_capacities(reader_cap: usize, writer_cap: usize, inner: S) -> BufferedStream<S> { let writer = BufferedWriter::with_capacity(writer_cap, inner); let internal_writer = InternalBufferedWriter(writer); @@ -407,11 +407,11 @@ impl<S: Stream> BufferedStream<S> { impl<S: Stream> Buffer for BufferedStream<S> { fn fill_buf<'a>(&'a mut self) -> IoResult<&'a [u8]> { self.inner.fill_buf() } - fn consume(&mut self, amt: uint) { self.inner.consume(amt) } + fn consume(&mut self, amt: usize) { self.inner.consume(amt) } } impl<S: Stream> Reader for BufferedStream<S> { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.inner.read(buf) } } @@ -442,7 +442,7 @@ mod test { pub struct NullStream; impl Reader for NullStream { - fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> { Err(old_io::standard_error(old_io::EndOfFile)) } } @@ -453,11 +453,11 @@ mod test { /// A dummy reader intended at testing short-reads propagation. pub struct ShortReader { - lengths: Vec<uint>, + lengths: Vec<usize>, } impl Reader for ShortReader { - fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> { if self.lengths.is_empty() { Err(old_io::standard_error(old_io::EndOfFile)) } else { @@ -565,7 +565,7 @@ mod test { } impl old_io::Reader for S { - fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> { Err(old_io::standard_error(old_io::EndOfFile)) } } diff --git a/src/libstd/old_io/comm_adapters.rs b/src/libstd/old_io/comm_adapters.rs index cd8252540da..35bc58fecd2 100644 --- a/src/libstd/old_io/comm_adapters.rs +++ b/src/libstd/old_io/comm_adapters.rs @@ -39,7 +39,7 @@ use vec::Vec; /// ``` pub struct ChanReader { buf: Vec<u8>, // A buffer of bytes received but not consumed. - pos: uint, // How many of the buffered bytes have already be consumed. + pos: usize, // How many of the buffered bytes have already be consumed. rx: Receiver<Vec<u8>>, // The Receiver to pull data from. closed: bool, // Whether the channel this Receiver connects to has been closed. } @@ -77,14 +77,14 @@ impl Buffer for ChanReader { } } - fn consume(&mut self, amt: uint) { + fn consume(&mut self, amt: usize) { self.pos += amt; assert!(self.pos <= self.buf.len()); } } impl Reader for ChanReader { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { let mut num_read = 0; loop { let count = match self.fill_buf().ok() { diff --git a/src/libstd/old_io/extensions.rs b/src/libstd/old_io/extensions.rs index 5b1b9471b07..441f0a7536e 100644 --- a/src/libstd/old_io/extensions.rs +++ b/src/libstd/old_io/extensions.rs @@ -81,7 +81,7 @@ impl<'r, R: Reader> Iterator for Bytes<'r, R> { /// * `f`: A callback that receives the value. /// /// This function returns the value returned by the callback, for convenience. -pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where +pub fn u64_to_le_bytes<T, F>(n: u64, size: usize, f: F) -> T where F: FnOnce(&[u8]) -> T, { use mem::transmute; @@ -122,7 +122,7 @@ pub fn u64_to_le_bytes<T, F>(n: u64, size: uint, f: F) -> T where /// * `f`: A callback that receives the value. /// /// This function returns the value returned by the callback, for convenience. -pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where +pub fn u64_to_be_bytes<T, F>(n: u64, size: usize, f: F) -> T where F: FnOnce(&[u8]) -> T, { use mem::transmute; @@ -158,7 +158,7 @@ pub fn u64_to_be_bytes<T, F>(n: u64, size: uint, f: F) -> T where /// less, or task panic occurs. If this is less than 8, then only /// that many bytes are parsed. For example, if `size` is 4, then a /// 32-bit value is parsed. -pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 { +pub fn u64_from_be_bytes(data: &[u8], start: usize, size: usize) -> u64 { use ptr::{copy_nonoverlapping}; assert!(size <= 8); @@ -169,9 +169,9 @@ pub fn u64_from_be_bytes(data: &[u8], start: uint, size: uint) -> u64 { let mut buf = [0; 8]; unsafe { - let ptr = data.as_ptr().offset(start as int); + let ptr = data.as_ptr().offset(start as isize); let out = buf.as_mut_ptr(); - copy_nonoverlapping(out.offset((8 - size) as int), ptr, size); + copy_nonoverlapping(out.offset((8 - size) as isize), ptr, size); (*(out as *const u64)).to_be() } } @@ -183,11 +183,11 @@ mod test { use old_io::{MemReader, BytesReader}; struct InitialZeroByteReader { - count: int, + count: isize, } impl Reader for InitialZeroByteReader { - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { if self.count == 0 { self.count = 1; Ok(0) @@ -201,7 +201,7 @@ mod test { struct EofReader; impl Reader for EofReader { - fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> { Err(old_io::standard_error(old_io::EndOfFile)) } } @@ -209,17 +209,17 @@ mod test { struct ErroringReader; impl Reader for ErroringReader { - fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, _: &mut [u8]) -> old_io::IoResult<usize> { Err(old_io::standard_error(old_io::InvalidInput)) } } struct PartialReader { - count: int, + count: isize, } impl Reader for PartialReader { - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { if self.count == 0 { self.count = 1; buf[0] = 10; @@ -234,11 +234,11 @@ mod test { } struct ErroringLaterReader { - count: int, + count: isize, } impl Reader for ErroringLaterReader { - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { if self.count == 0 { self.count = 1; buf[0] = 10; @@ -250,11 +250,11 @@ mod test { } struct ThreeChunkReader { - count: int, + count: isize, } impl Reader for ThreeChunkReader { - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { if self.count == 0 { self.count = 1; buf[0] = 10; diff --git a/src/libstd/old_io/fs.rs b/src/libstd/old_io/fs.rs index 40a7cce81dd..9ce8e53f6e9 100644 --- a/src/libstd/old_io/fs.rs +++ b/src/libstd/old_io/fs.rs @@ -88,7 +88,7 @@ use sys_common; pub struct File { fd: fs_imp::FileDesc, path: Path, - last_nread: int, + last_nread: isize, } impl sys_common::AsInner<fs_imp::FileDesc> for File { @@ -472,14 +472,14 @@ pub fn copy(from: &Path, to: &Path) -> IoResult<()> { #[deprecated(since = "1.0.0", reason = "replaced with std::fs::set_permissions")] #[unstable(feature = "old_io")] pub fn chmod(path: &Path, mode: old_io::FilePermission) -> IoResult<()> { - fs_imp::chmod(path, mode.bits() as uint) + fs_imp::chmod(path, mode.bits() as usize) .update_err("couldn't chmod path", |e| format!("{}; path={}; mode={:?}", e, path.display(), mode)) } /// Change the user and group owners of a file at the specified path. #[unstable(feature = "old_fs")] -pub fn chown(path: &Path, uid: int, gid: int) -> IoResult<()> { +pub fn chown(path: &Path, uid: isize, gid: isize) -> IoResult<()> { fs_imp::chown(path, uid, gid) .update_err("couldn't chown path", |e| format!("{}; path={}; uid={}; gid={}", e, path.display(), uid, gid)) @@ -541,7 +541,7 @@ pub fn readlink(path: &Path) -> IoResult<Path> { /// new directory at the provided `path`, or if the directory already exists. #[unstable(feature = "old_fs")] pub fn mkdir(path: &Path, mode: FilePermission) -> IoResult<()> { - fs_imp::mkdir(path, mode.bits() as uint) + fs_imp::mkdir(path, mode.bits() as usize) .update_err("couldn't create directory", |e| format!("{}; path={}; mode={}", e, path.display(), mode)) } @@ -773,7 +773,7 @@ pub fn change_file_times(path: &Path, atime: u64, mtime: u64) -> IoResult<()> { } impl Reader for File { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { fn update_err<T>(result: IoResult<T>, file: &File) -> IoResult<T> { result.update_err("couldn't read file", |e| format!("{}; path={}", @@ -784,10 +784,10 @@ impl Reader for File { match result { Ok(read) => { - self.last_nread = read as int; + self.last_nread = read as isize; match read { 0 => update_err(Err(standard_error(old_io::EndOfFile)), self), - _ => Ok(read as uint) + _ => Ok(read as usize) } }, Err(e) => Err(e) @@ -1227,8 +1227,8 @@ mod test { let stem = f.filestem_str().unwrap(); let root = stem.as_bytes()[0] - b'0'; let name = stem.as_bytes()[1] - b'0'; - assert!(cur[root as uint] < name); - cur[root as uint] = name; + assert!(cur[root as usize] < name); + cur[root as usize] = name; } check!(rmdir_recursive(dir)); diff --git a/src/libstd/old_io/mem.rs b/src/libstd/old_io/mem.rs index d877a60b079..b84515c62f6 100644 --- a/src/libstd/old_io/mem.rs +++ b/src/libstd/old_io/mem.rs @@ -20,9 +20,9 @@ use old_io::{Reader, Writer, Seek, Buffer, IoError, SeekStyle, IoResult}; use slice; use vec::Vec; -const BUF_CAPACITY: uint = 128; +const BUF_CAPACITY: usize = 128; -fn combine(seek: SeekStyle, cur: uint, end: uint, offset: i64) -> IoResult<u64> { +fn combine(seek: SeekStyle, cur: usize, end: usize, offset: i64) -> IoResult<u64> { // compute offset as signed and clamp to prevent overflow let pos = match seek { old_io::SeekSet => 0, @@ -82,7 +82,7 @@ impl MemWriter { /// Create a new `MemWriter`, allocating at least `n` bytes for /// the internal buffer. #[inline] - pub fn with_capacity(n: uint) -> MemWriter { + pub fn with_capacity(n: usize) -> MemWriter { MemWriter::from_vec(Vec::with_capacity(n)) } /// Create a new `MemWriter` that will append to an existing `Vec`. @@ -125,7 +125,7 @@ impl Writer for MemWriter { /// ``` pub struct MemReader { buf: Vec<u8>, - pos: uint + pos: usize } impl MemReader { @@ -160,7 +160,7 @@ impl MemReader { impl Reader for MemReader { #[inline] - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { if self.eof() { return Err(old_io::standard_error(old_io::EndOfFile)) } let write_len = min(buf.len(), self.buf.len() - self.pos); @@ -184,7 +184,7 @@ impl Seek for MemReader { #[inline] fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> { let new = try!(combine(style, self.pos, self.buf.len(), pos)); - self.pos = new as uint; + self.pos = new as usize; Ok(()) } } @@ -200,12 +200,12 @@ impl Buffer for MemReader { } #[inline] - fn consume(&mut self, amt: uint) { self.pos += amt; } + fn consume(&mut self, amt: usize) { self.pos += amt; } } impl<'a> Reader for &'a [u8] { #[inline] - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { if self.is_empty() { return Err(old_io::standard_error(old_io::EndOfFile)); } let write_len = min(buf.len(), self.len()); @@ -232,7 +232,7 @@ impl<'a> Buffer for &'a [u8] { } #[inline] - fn consume(&mut self, amt: uint) { + fn consume(&mut self, amt: usize) { *self = &self[amt..]; } } @@ -259,7 +259,7 @@ impl<'a> Buffer for &'a [u8] { /// ``` pub struct BufWriter<'a> { buf: &'a mut [u8], - pos: uint + pos: usize } impl<'a> BufWriter<'a> { @@ -309,7 +309,7 @@ impl<'a> Seek for BufWriter<'a> { #[inline] fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> { let new = try!(combine(style, self.pos, self.buf.len(), pos)); - self.pos = min(new as uint, self.buf.len()); + self.pos = min(new as usize, self.buf.len()); Ok(()) } } @@ -330,7 +330,7 @@ impl<'a> Seek for BufWriter<'a> { /// ``` pub struct BufReader<'a> { buf: &'a [u8], - pos: uint + pos: usize } impl<'a> BufReader<'a> { @@ -352,7 +352,7 @@ impl<'a> BufReader<'a> { impl<'a> Reader for BufReader<'a> { #[inline] - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { if self.eof() { return Err(old_io::standard_error(old_io::EndOfFile)) } let write_len = min(buf.len(), self.buf.len() - self.pos); @@ -376,7 +376,7 @@ impl<'a> Seek for BufReader<'a> { #[inline] fn seek(&mut self, pos: i64, style: SeekStyle) -> IoResult<()> { let new = try!(combine(style, self.pos, self.buf.len(), pos)); - self.pos = new as uint; + self.pos = new as usize; Ok(()) } } @@ -392,7 +392,7 @@ impl<'a> Buffer for BufReader<'a> { } #[inline] - fn consume(&mut self, amt: uint) { self.pos += amt; } + fn consume(&mut self, amt: usize) { self.pos += amt; } } #[cfg(test)] @@ -663,7 +663,7 @@ mod test { assert_eq!(buf, b); } - fn do_bench_mem_writer(b: &mut Bencher, times: uint, len: uint) { + fn do_bench_mem_writer(b: &mut Bencher, times: usize, len: usize) { let src: Vec<u8> = repeat(5).take(len).collect(); b.bytes = (times * len) as u64; diff --git a/src/libstd/old_io/mod.rs b/src/libstd/old_io/mod.rs index ac908c529dc..1bbd602b18a 100644 --- a/src/libstd/old_io/mod.rs +++ b/src/libstd/old_io/mod.rs @@ -326,7 +326,7 @@ pub mod test; /// The default buffer size for various I/O operations // libuv recommends 64k buffers to maximize throughput // https://groups.google.com/forum/#!topic/libuv/oQO1HJAIDdA -const DEFAULT_BUF_SIZE: uint = 1024 * 64; +const DEFAULT_BUF_SIZE: usize = 1024 * 64; /// A convenient typedef of the return value of any I/O action. pub type IoResult<T> = Result<T, IoError>; @@ -441,7 +441,7 @@ pub enum IoErrorKind { /// /// The payload contained as part of this variant is the number of bytes /// which are known to have been successfully written. - ShortWrite(uint), + ShortWrite(usize), /// The Reader returned 0 bytes from `read()` too many times. NoProgress, } @@ -483,7 +483,7 @@ impl<T> UpdateIoError for IoResult<T> { } } -static NO_PROGRESS_LIMIT: uint = 1000; +static NO_PROGRESS_LIMIT: usize = 1000; /// A trait for objects which are byte-oriented streams. Readers are defined by /// one method, `read`. This function will block until data is available, @@ -511,7 +511,7 @@ pub trait Reader { /// /// When implementing this method on a new Reader, you are strongly encouraged /// not to return 0 if you can avoid it. - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint>; + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize>; // Convenient helper methods based on the above methods @@ -526,7 +526,7 @@ pub trait Reader { /// /// If an error occurs at any point, that error is returned, and no further /// bytes are read. - fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult<uint> { + fn read_at_least(&mut self, min: usize, buf: &mut [u8]) -> IoResult<usize> { if min > buf.len() { return Err(IoError { detail: Some(String::from_str("the buffer is too short")), @@ -570,7 +570,7 @@ pub trait Reader { /// /// If an error occurs during this I/O operation, then it is returned /// as `Err(IoError)`. See `read()` for more details. - fn push(&mut self, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> { + fn push(&mut self, len: usize, buf: &mut Vec<u8>) -> IoResult<usize> { let start_len = buf.len(); buf.reserve(len); @@ -594,7 +594,7 @@ pub trait Reader { /// /// If an error occurs at any point, that error is returned, and no further /// bytes are read. - fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> { + fn push_at_least(&mut self, min: usize, len: usize, buf: &mut Vec<u8>) -> IoResult<usize> { if min > len { return Err(IoError { detail: Some(String::from_str("the buffer is too short")), @@ -629,7 +629,7 @@ pub trait Reader { /// have already been consumed from the underlying reader, and they are lost /// (not returned as part of the error). If this is unacceptable, then it is /// recommended to use the `push_at_least` or `read` methods. - fn read_exact(&mut self, len: uint) -> IoResult<Vec<u8>> { + fn read_exact(&mut self, len: usize) -> IoResult<Vec<u8>> { let mut buf = Vec::with_capacity(len); match self.push_at_least(len, len, &mut buf) { Ok(_) => Ok(buf), @@ -679,7 +679,7 @@ pub trait Reader { /// Reads `n` little-endian unsigned integer bytes. /// /// `n` must be between 1 and 8, inclusive. - fn read_le_uint_n(&mut self, nbytes: uint) -> IoResult<u64> { + fn read_le_uint_n(&mut self, nbytes: usize) -> IoResult<u64> { assert!(nbytes > 0 && nbytes <= 8); let mut val = 0; @@ -696,14 +696,14 @@ pub trait Reader { /// Reads `n` little-endian signed integer bytes. /// /// `n` must be between 1 and 8, inclusive. - fn read_le_int_n(&mut self, nbytes: uint) -> IoResult<i64> { + fn read_le_int_n(&mut self, nbytes: usize) -> IoResult<i64> { self.read_le_uint_n(nbytes).map(|i| extend_sign(i, nbytes)) } /// Reads `n` big-endian unsigned integer bytes. /// /// `n` must be between 1 and 8, inclusive. - fn read_be_uint_n(&mut self, nbytes: uint) -> IoResult<u64> { + fn read_be_uint_n(&mut self, nbytes: usize) -> IoResult<u64> { assert!(nbytes > 0 && nbytes <= 8); let mut val = 0; @@ -718,36 +718,36 @@ pub trait Reader { /// Reads `n` big-endian signed integer bytes. /// /// `n` must be between 1 and 8, inclusive. - fn read_be_int_n(&mut self, nbytes: uint) -> IoResult<i64> { + fn read_be_int_n(&mut self, nbytes: usize) -> IoResult<i64> { self.read_be_uint_n(nbytes).map(|i| extend_sign(i, nbytes)) } /// Reads a little-endian unsigned integer. /// /// The number of bytes returned is system-dependent. - fn read_le_uint(&mut self) -> IoResult<uint> { - self.read_le_uint_n(usize::BYTES as usize).map(|i| i as uint) + fn read_le_uint(&mut self) -> IoResult<usize> { + self.read_le_uint_n(usize::BYTES as usize).map(|i| i as usize) } /// Reads a little-endian integer. /// /// The number of bytes returned is system-dependent. - fn read_le_int(&mut self) -> IoResult<int> { - self.read_le_int_n(isize::BYTES as usize).map(|i| i as int) + fn read_le_int(&mut self) -> IoResult<isize> { + self.read_le_int_n(isize::BYTES as usize).map(|i| i as isize) } /// Reads a big-endian unsigned integer. /// /// The number of bytes returned is system-dependent. - fn read_be_uint(&mut self) -> IoResult<uint> { - self.read_be_uint_n(usize::BYTES as usize).map(|i| i as uint) + fn read_be_uint(&mut self) -> IoResult<usize> { + self.read_be_uint_n(usize::BYTES as usize).map(|i| i as usize) } /// Reads a big-endian integer. /// /// The number of bytes returned is system-dependent. - fn read_be_int(&mut self) -> IoResult<int> { - self.read_be_int_n(isize::BYTES as usize).map(|i| i as int) + fn read_be_int(&mut self) -> IoResult<isize> { + self.read_be_int_n(isize::BYTES as usize).map(|i| i as isize) } /// Reads a big-endian `u64`. @@ -919,14 +919,14 @@ impl<T: Reader> BytesReader for T { } impl<'a> Reader for Box<Reader+'a> { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { let reader: &mut Reader = &mut **self; reader.read(buf) } } impl<'a> Reader for &'a mut (Reader+'a) { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { (*self).read(buf) } + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { (*self).read(buf) } } /// Returns a slice of `v` between `start` and `end`. @@ -940,13 +940,13 @@ impl<'a> Reader for &'a mut (Reader+'a) { /// `start` > `end`. // Private function here because we aren't sure if we want to expose this as // API yet. If so, it should be a method on Vec. -unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: uint, end: uint) -> &'a mut [T] { +unsafe fn slice_vec_capacity<'a, T>(v: &'a mut Vec<T>, start: usize, end: usize) -> &'a mut [T] { use slice; assert!(start <= end); assert!(end <= v.capacity()); slice::from_raw_parts_mut( - v.as_mut_ptr().offset(start as int), + v.as_mut_ptr().offset(start as isize), end - start ) } @@ -980,15 +980,15 @@ pub struct RefReader<'a, R:'a> { } impl<'a, R: Reader> Reader for RefReader<'a, R> { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { self.inner.read(buf) } + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.inner.read(buf) } } impl<'a, R: Buffer> Buffer for RefReader<'a, R> { fn fill_buf(&mut self) -> IoResult<&[u8]> { self.inner.fill_buf() } - fn consume(&mut self, amt: uint) { self.inner.consume(amt) } + fn consume(&mut self, amt: usize) { self.inner.consume(amt) } } -fn extend_sign(val: u64, nbytes: uint) -> i64 { +fn extend_sign(val: u64, nbytes: usize) -> i64 { let shift = (8 - nbytes) * 8; (val << shift) as i64 >> shift } @@ -1095,39 +1095,39 @@ pub trait Writer { self.write_all(&buf[..n]) } - /// Write the result of passing n through `int::to_str_bytes`. + /// Write the result of passing n through `isize::to_str_bytes`. #[inline] - fn write_int(&mut self, n: int) -> IoResult<()> { + fn write_int(&mut self, n: isize) -> IoResult<()> { write!(self, "{}", n) } - /// Write the result of passing n through `uint::to_str_bytes`. + /// Write the result of passing n through `usize::to_str_bytes`. #[inline] - fn write_uint(&mut self, n: uint) -> IoResult<()> { + fn write_uint(&mut self, n: usize) -> IoResult<()> { write!(self, "{}", n) } - /// Write a little-endian uint (number of bytes depends on system). + /// Write a little-endian usize (number of bytes depends on system). #[inline] - fn write_le_uint(&mut self, n: uint) -> IoResult<()> { + fn write_le_uint(&mut self, n: usize) -> IoResult<()> { extensions::u64_to_le_bytes(n as u64, usize::BYTES as usize, |v| self.write_all(v)) } - /// Write a little-endian int (number of bytes depends on system). + /// Write a little-endian isize (number of bytes depends on system). #[inline] - fn write_le_int(&mut self, n: int) -> IoResult<()> { + fn write_le_int(&mut self, n: isize) -> IoResult<()> { extensions::u64_to_le_bytes(n as u64, isize::BYTES as usize, |v| self.write_all(v)) } - /// Write a big-endian uint (number of bytes depends on system). + /// Write a big-endian usize (number of bytes depends on system). #[inline] - fn write_be_uint(&mut self, n: uint) -> IoResult<()> { + fn write_be_uint(&mut self, n: usize) -> IoResult<()> { extensions::u64_to_be_bytes(n as u64, usize::BYTES as usize, |v| self.write_all(v)) } - /// Write a big-endian int (number of bytes depends on system). + /// Write a big-endian isize (number of bytes depends on system). #[inline] - fn write_be_int(&mut self, n: int) -> IoResult<()> { + fn write_be_int(&mut self, n: isize) -> IoResult<()> { extensions::u64_to_be_bytes(n as u64, isize::BYTES as usize, |v| self.write_all(v)) } @@ -1409,7 +1409,7 @@ pub trait Buffer: Reader { /// Tells this buffer that `amt` bytes have been consumed from the buffer, /// so they should no longer be returned in calls to `read`. - fn consume(&mut self, amt: uint); + fn consume(&mut self, amt: usize); /// Reads the next line of input, interpreted as a sequence of UTF-8 /// encoded Unicode codepoints. If a newline is encountered, then the @@ -1870,8 +1870,8 @@ mod tests { #[derive(Clone, PartialEq, Debug)] enum BadReaderBehavior { - GoodBehavior(uint), - BadBehavior(uint) + GoodBehavior(usize), + BadBehavior(usize) } struct BadReader<T> { @@ -1886,7 +1886,7 @@ mod tests { } impl<T: Reader> Reader for BadReader<T> { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { let BadReader { ref mut behavior, ref mut r } = *self; loop { if behavior.is_empty() { diff --git a/src/libstd/old_io/net/addrinfo.rs b/src/libstd/old_io/net/addrinfo.rs index 2b7506b5c34..0413a89ac4f 100644 --- a/src/libstd/old_io/net/addrinfo.rs +++ b/src/libstd/old_io/net/addrinfo.rs @@ -63,19 +63,19 @@ pub enum Protocol { /// `man -s 3 getaddrinfo` #[derive(Copy, Debug)] pub struct Hint { - pub family: uint, + pub family: usize, pub socktype: Option<SocketType>, pub protocol: Option<Protocol>, - pub flags: uint, + pub flags: usize, } #[derive(Copy, Debug)] pub struct Info { pub address: SocketAddr, - pub family: uint, + pub family: usize, pub socktype: Option<SocketType>, pub protocol: Option<Protocol>, - pub flags: uint, + pub flags: usize, } /// Easy name resolution. Given a hostname, returns the list of IP addresses for diff --git a/src/libstd/old_io/net/ip.rs b/src/libstd/old_io/net/ip.rs index f7953ac51b8..ba3578f7425 100644 --- a/src/libstd/old_io/net/ip.rs +++ b/src/libstd/old_io/net/ip.rs @@ -82,7 +82,7 @@ impl fmt::Display for SocketAddr { struct Parser<'a> { // parsing as ASCII, so can use byte array s: &'a [u8], - pos: uint, + pos: usize, } impl<'a> Parser<'a> { @@ -256,7 +256,7 @@ impl<'a> Parser<'a> { Ipv6Addr(gs[0], gs[1], gs[2], gs[3], gs[4], gs[5], gs[6], gs[7]) } - fn read_groups(p: &mut Parser, groups: &mut [u16; 8], limit: uint) -> (uint, bool) { + fn read_groups(p: &mut Parser, groups: &mut [u16; 8], limit: usize) -> (usize, bool) { let mut i = 0; while i < limit { if i < limit - 1 { diff --git a/src/libstd/old_io/net/pipe.rs b/src/libstd/old_io/net/pipe.rs index f9e5ae71e12..2f3cf3d84d0 100644 --- a/src/libstd/old_io/net/pipe.rs +++ b/src/libstd/old_io/net/pipe.rs @@ -150,7 +150,7 @@ impl Clone for UnixStream { } impl Reader for UnixStream { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.inner.read(buf) } } diff --git a/src/libstd/old_io/net/tcp.rs b/src/libstd/old_io/net/tcp.rs index 75f786f0bb1..d55d9ca11d1 100644 --- a/src/libstd/old_io/net/tcp.rs +++ b/src/libstd/old_io/net/tcp.rs @@ -122,7 +122,7 @@ impl TcpStream { /// this connection. Otherwise, the keepalive timeout will be set to the /// specified time, in seconds. #[unstable(feature = "io")] - pub fn set_keepalive(&mut self, delay_in_seconds: Option<uint>) -> IoResult<()> { + pub fn set_keepalive(&mut self, delay_in_seconds: Option<usize>) -> IoResult<()> { self.inner.set_keepalive(delay_in_seconds) } @@ -257,7 +257,7 @@ impl Clone for TcpStream { } impl Reader for TcpStream { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.inner.read(buf) } } @@ -789,12 +789,12 @@ mod test { #[test] fn multiple_connect_interleaved_greedy_schedule_ip4() { let addr = next_test_ip4(); - static MAX: int = 10; + static MAX: isize = 10; let acceptor = TcpListener::bind(addr).listen(); let _t = thread::spawn(move|| { let mut acceptor = acceptor; - for (i, stream) in acceptor.incoming().enumerate().take(MAX as uint) { + for (i, stream) in acceptor.incoming().enumerate().take(MAX as usize) { // Start another task to handle the connection let _t = thread::spawn(move|| { let mut stream = stream; @@ -808,7 +808,7 @@ mod test { connect(0, addr); - fn connect(i: int, addr: SocketAddr) { + fn connect(i: isize, addr: SocketAddr) { if i == MAX { return } let _t = thread::spawn(move|| { @@ -825,12 +825,12 @@ mod test { #[test] fn multiple_connect_interleaved_greedy_schedule_ip6() { let addr = next_test_ip6(); - static MAX: int = 10; + static MAX: isize = 10; let acceptor = TcpListener::bind(addr).listen(); let _t = thread::spawn(move|| { let mut acceptor = acceptor; - for (i, stream) in acceptor.incoming().enumerate().take(MAX as uint) { + for (i, stream) in acceptor.incoming().enumerate().take(MAX as usize) { // Start another task to handle the connection let _t = thread::spawn(move|| { let mut stream = stream; @@ -844,7 +844,7 @@ mod test { connect(0, addr); - fn connect(i: int, addr: SocketAddr) { + fn connect(i: isize, addr: SocketAddr) { if i == MAX { return } let _t = thread::spawn(move|| { @@ -860,13 +860,13 @@ mod test { #[test] fn multiple_connect_interleaved_lazy_schedule_ip4() { - static MAX: int = 10; + static MAX: isize = 10; let addr = next_test_ip4(); let acceptor = TcpListener::bind(addr).listen(); let _t = thread::spawn(move|| { let mut acceptor = acceptor; - for stream in acceptor.incoming().take(MAX as uint) { + for stream in acceptor.incoming().take(MAX as usize) { // Start another task to handle the connection let _t = thread::spawn(move|| { let mut stream = stream; @@ -880,7 +880,7 @@ mod test { connect(0, addr); - fn connect(i: int, addr: SocketAddr) { + fn connect(i: isize, addr: SocketAddr) { if i == MAX { return } let _t = thread::spawn(move|| { @@ -896,13 +896,13 @@ mod test { #[test] fn multiple_connect_interleaved_lazy_schedule_ip6() { - static MAX: int = 10; + static MAX: isize = 10; let addr = next_test_ip6(); let acceptor = TcpListener::bind(addr).listen(); let _t = thread::spawn(move|| { let mut acceptor = acceptor; - for stream in acceptor.incoming().take(MAX as uint) { + for stream in acceptor.incoming().take(MAX as usize) { // Start another task to handle the connection let _t = thread::spawn(move|| { let mut stream = stream; @@ -916,7 +916,7 @@ mod test { connect(0, addr); - fn connect(i: int, addr: SocketAddr) { + fn connect(i: isize, addr: SocketAddr) { if i == MAX { return } let _t = thread::spawn(move|| { diff --git a/src/libstd/old_io/net/udp.rs b/src/libstd/old_io/net/udp.rs index 3aa811974b3..196447d71ef 100644 --- a/src/libstd/old_io/net/udp.rs +++ b/src/libstd/old_io/net/udp.rs @@ -73,7 +73,7 @@ impl UdpSocket { /// Receives data from the socket. On success, returns the number of bytes /// read and the address from whence the data came. - pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(uint, SocketAddr)> { + pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(usize, SocketAddr)> { self.inner.recv_from(buf) } @@ -113,13 +113,13 @@ impl UdpSocket { /// Sets the multicast TTL #[unstable(feature = "io")] - pub fn set_multicast_ttl(&mut self, ttl: int) -> IoResult<()> { + pub fn set_multicast_ttl(&mut self, ttl: isize) -> IoResult<()> { self.inner.multicast_time_to_live(ttl) } /// Sets this socket's TTL #[unstable(feature = "io")] - pub fn set_ttl(&mut self, ttl: int) -> IoResult<()> { + pub fn set_ttl(&mut self, ttl: isize) -> IoResult<()> { self.inner.time_to_live(ttl) } diff --git a/src/libstd/old_io/pipe.rs b/src/libstd/old_io/pipe.rs index 0b555e2f0ff..26f24600479 100644 --- a/src/libstd/old_io/pipe.rs +++ b/src/libstd/old_io/pipe.rs @@ -100,7 +100,7 @@ impl Clone for PipeStream { } impl Reader for PipeStream { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.inner.read(buf) } } diff --git a/src/libstd/old_io/process.rs b/src/libstd/old_io/process.rs index d7ede451fb8..45bf5a58ec2 100644 --- a/src/libstd/old_io/process.rs +++ b/src/libstd/old_io/process.rs @@ -41,16 +41,16 @@ use thread; /// Signal a process to exit, without forcibly killing it. Corresponds to /// SIGTERM on unix platforms. -#[cfg(windows)] pub const PleaseExitSignal: int = 15; +#[cfg(windows)] pub const PleaseExitSignal: isize = 15; /// Signal a process to exit immediately, forcibly killing it. Corresponds to /// SIGKILL on unix platforms. -#[cfg(windows)] pub const MustDieSignal: int = 9; +#[cfg(windows)] pub const MustDieSignal: isize = 9; /// Signal a process to exit, without forcibly killing it. Corresponds to /// SIGTERM on unix platforms. -#[cfg(not(windows))] pub const PleaseExitSignal: int = libc::SIGTERM as int; +#[cfg(not(windows))] pub const PleaseExitSignal: isize = libc::SIGTERM as isize; /// Signal a process to exit immediately, forcibly killing it. Corresponds to /// SIGKILL on unix platforms. -#[cfg(not(windows))] pub const MustDieSignal: int = libc::SIGKILL as int; +#[cfg(not(windows))] pub const MustDieSignal: isize = libc::SIGKILL as isize; /// Representation of a running or exited child process. /// @@ -80,7 +80,7 @@ pub struct Process { exit_code: Option<ProcessExit>, /// Manually delivered signal - exit_signal: Option<int>, + exit_signal: Option<isize>, /// Deadline after which wait() will return deadline: u64, @@ -186,8 +186,8 @@ pub struct Command { stdin: StdioContainer, stdout: StdioContainer, stderr: StdioContainer, - uid: Option<uint>, - gid: Option<uint>, + uid: Option<usize>, + gid: Option<usize>, detach: bool, } @@ -321,14 +321,14 @@ impl Command { /// the child process. Setting this value on windows will cause the spawn to /// fail. Failure in the `setuid` call on unix will also cause the spawn to /// fail. - pub fn uid<'a>(&'a mut self, id: uint) -> &'a mut Command { + pub fn uid<'a>(&'a mut self, id: usize) -> &'a mut Command { self.uid = Some(id); self } /// Similar to `uid`, but sets the group id of the child process. This has /// the same semantics as the `uid` field. - pub fn gid<'a>(&'a mut self, id: uint) -> &'a mut Command { + pub fn gid<'a>(&'a mut self, id: usize) -> &'a mut Command { self.gid = Some(id); self } @@ -458,10 +458,10 @@ impl sys::process::ProcessConfig<EnvKey, CString> for Command { fn cwd(&self) -> Option<&CString> { self.cwd.as_ref() } - fn uid(&self) -> Option<uint> { + fn uid(&self) -> Option<usize> { self.uid.clone() } - fn gid(&self) -> Option<uint> { + fn gid(&self) -> Option<usize> { self.gid.clone() } fn detach(&self) -> bool { @@ -507,10 +507,10 @@ pub enum StdioContainer { #[derive(PartialEq, Eq, Clone, Copy, Debug)] pub enum ProcessExit { /// Normal termination with an exit status. - ExitStatus(int), + ExitStatus(isize), /// Termination by signal, with the signal number. - ExitSignal(int), + ExitSignal(isize), } #[stable(feature = "rust1", since = "1.0.0")] @@ -533,7 +533,7 @@ impl ProcessExit { /// Checks whether this ProcessExit matches the given exit status. /// Termination by signal will never match an exit code. - pub fn matches_exit_status(&self, wanted: int) -> bool { + pub fn matches_exit_status(&self, wanted: isize) -> bool { *self == ExitStatus(wanted) } } @@ -549,7 +549,7 @@ impl Process { /// process. Note, though, that on some platforms signals will continue to /// be successfully delivered if the child has exited, but not yet been /// reaped. - pub fn kill(id: libc::pid_t, signal: int) -> IoResult<()> { + pub fn kill(id: libc::pid_t, signal: isize) -> IoResult<()> { unsafe { ProcessImp::killpid(id, signal) } } @@ -571,7 +571,7 @@ impl Process { /// # Errors /// /// If the signal delivery fails, the corresponding error is returned. - pub fn signal(&mut self, signal: int) -> IoResult<()> { + pub fn signal(&mut self, signal: isize) -> IoResult<()> { #[cfg(unix)] fn collect_status(p: &mut Process) { // On Linux (and possibly other unices), a process that has exited will // continue to accept signals because it is "defunct". The delivery of @@ -888,8 +888,8 @@ mod tests { use libc; let mut p = Command::new("/bin/sh") .arg("-c").arg("true") - .uid(unsafe { libc::getuid() as uint }) - .gid(unsafe { libc::getgid() as uint }) + .uid(unsafe { libc::getuid() as usize }) + .gid(unsafe { libc::getgid() as usize }) .spawn().unwrap(); assert!(p.wait().unwrap().success()); } diff --git a/src/libstd/old_io/result.rs b/src/libstd/old_io/result.rs index 9dcb487cdb0..cda19f8ae84 100644 --- a/src/libstd/old_io/result.rs +++ b/src/libstd/old_io/result.rs @@ -35,7 +35,7 @@ impl<W: Writer> Writer for IoResult<W> { } impl<R: Reader> Reader for IoResult<R> { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { match *self { Ok(ref mut reader) => reader.read(buf), Err(ref e) => Err(e.clone()), diff --git a/src/libstd/old_io/stdio.rs b/src/libstd/old_io/stdio.rs index 90d27084911..b4924c7b78b 100644 --- a/src/libstd/old_io/stdio.rs +++ b/src/libstd/old_io/stdio.rs @@ -182,7 +182,7 @@ impl StdinReader { } impl Reader for StdinReader { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { self.inner.lock().unwrap().0.read(buf) } @@ -190,11 +190,11 @@ impl Reader for StdinReader { // read more than once and we don't want those calls to interleave (or // incur the costs of repeated locking). - fn read_at_least(&mut self, min: uint, buf: &mut [u8]) -> IoResult<uint> { + fn read_at_least(&mut self, min: usize, buf: &mut [u8]) -> IoResult<usize> { self.inner.lock().unwrap().0.read_at_least(min, buf) } - fn push_at_least(&mut self, min: uint, len: uint, buf: &mut Vec<u8>) -> IoResult<uint> { + fn push_at_least(&mut self, min: usize, len: usize, buf: &mut Vec<u8>) -> IoResult<usize> { self.inner.lock().unwrap().0.push_at_least(min, len, buf) } @@ -202,11 +202,11 @@ impl Reader for StdinReader { self.inner.lock().unwrap().0.read_to_end() } - fn read_le_uint_n(&mut self, nbytes: uint) -> IoResult<u64> { + fn read_le_uint_n(&mut self, nbytes: usize) -> IoResult<u64> { self.inner.lock().unwrap().0.read_le_uint_n(nbytes) } - fn read_be_uint_n(&mut self, nbytes: uint) -> IoResult<u64> { + fn read_be_uint_n(&mut self, nbytes: usize) -> IoResult<u64> { self.inner.lock().unwrap().0.read_be_uint_n(nbytes) } } @@ -410,16 +410,16 @@ impl StdReader { } impl Reader for StdReader { - fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { let ret = match self.inner { TTY(ref mut tty) => { // Flush the task-local stdout so that weird issues like a // print!'d prompt not being shown until after the user hits // enter. flush(); - tty.read(buf).map(|i| i as uint) + tty.read(buf).map(|i| i as usize) }, - File(ref mut file) => file.read(buf).map(|i| i as uint), + File(ref mut file) => file.read(buf).map(|i| i as usize), }; match ret { // When reading a piped stdin, libuv will return 0-length reads when @@ -452,7 +452,7 @@ impl StdWriter { /// /// This function will return an error if the output stream is not actually /// connected to a TTY instance, or if querying the TTY instance fails. - pub fn winsize(&mut self) -> IoResult<(int, int)> { + pub fn winsize(&mut self) -> IoResult<(isize, isize)> { match self.inner { TTY(ref mut tty) => { tty.get_winsize() diff --git a/src/libstd/old_io/tempfile.rs b/src/libstd/old_io/tempfile.rs index c0f6ddaaef7..bf9b79ce65a 100644 --- a/src/libstd/old_io/tempfile.rs +++ b/src/libstd/old_io/tempfile.rs @@ -89,7 +89,7 @@ const NUM_RETRIES: u32 = 1 << 31; // be enough to dissuade an attacker from trying to preemptively create names // of that length, but not so huge that we unnecessarily drain the random number // generator of entropy. -const NUM_RAND_CHARS: uint = 12; +const NUM_RAND_CHARS: usize = 12; impl TempDir { /// Attempts to make a temporary directory inside of `tmpdir` whose name diff --git a/src/libstd/old_io/util.rs b/src/libstd/old_io/util.rs index 1f782b6f221..604099f1178 100644 --- a/src/libstd/old_io/util.rs +++ b/src/libstd/old_io/util.rs @@ -22,7 +22,7 @@ use slice::bytes::MutableByteVector; #[deprecated(since = "1.0.0", reason = "use std::io::Take")] #[unstable(feature = "old_io")] pub struct LimitReader<R> { - limit: uint, + limit: usize, inner: R } @@ -32,7 +32,7 @@ impl<R: Reader> LimitReader<R> { /// Creates a new `LimitReader` #[deprecated(since = "1.0.0", reason = "use std::io's take method instead")] #[unstable(feature = "old_io")] - pub fn new(r: R, limit: uint) -> LimitReader<R> { + pub fn new(r: R, limit: usize) -> LimitReader<R> { LimitReader { limit: limit, inner: r } } @@ -46,13 +46,13 @@ impl<R: Reader> LimitReader<R> { /// /// The reader may reach EOF after reading fewer bytes than indicated by /// this method if the underlying reader reaches EOF. - pub fn limit(&self) -> uint { self.limit } + pub fn limit(&self) -> usize { self.limit } } #[deprecated(since = "1.0.0", reason = "use std::io's take method instead")] #[unstable(feature = "old_io")] impl<R: Reader> Reader for LimitReader<R> { - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { if self.limit == 0 { return Err(old_io::standard_error(old_io::EndOfFile)); } @@ -80,7 +80,7 @@ impl<R: Buffer> Buffer for LimitReader<R> { } } - fn consume(&mut self, amt: uint) { + fn consume(&mut self, amt: usize) { // Don't let callers reset the limit by passing an overlarge value let amt = cmp::min(amt, self.limit); self.limit -= amt; @@ -112,7 +112,7 @@ pub struct ZeroReader; #[unstable(feature = "old_io")] impl Reader for ZeroReader { #[inline] - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { buf.set_memory(0); Ok(buf.len()) } @@ -126,7 +126,7 @@ impl Buffer for ZeroReader { Ok(&DATA) } - fn consume(&mut self, _amt: uint) {} + fn consume(&mut self, _amt: usize) {} } /// A `Reader` which is always at EOF, like /dev/null. @@ -139,7 +139,7 @@ pub struct NullReader; #[unstable(feature = "old_io")] impl Reader for NullReader { #[inline] - fn read(&mut self, _buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, _buf: &mut [u8]) -> old_io::IoResult<usize> { Err(old_io::standard_error(old_io::EndOfFile)) } } @@ -150,7 +150,7 @@ impl Buffer for NullReader { fn fill_buf<'a>(&'a mut self) -> old_io::IoResult<&'a [u8]> { Err(old_io::standard_error(old_io::EndOfFile)) } - fn consume(&mut self, _amt: uint) {} + fn consume(&mut self, _amt: usize) {} } /// A `Writer` which multiplexes writes to a set of `Writer`s. @@ -216,7 +216,7 @@ impl<R: Reader, I: Iterator<Item=R>> ChainedReader<I, R> { #[deprecated(since = "1.0.0", reason = "use std::io::Chain instead")] #[unstable(feature = "old_io")] impl<R: Reader, I: Iterator<Item=R>> Reader for ChainedReader<I, R> { - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { loop { let err = match self.cur_reader { Some(ref mut r) => { @@ -269,7 +269,7 @@ impl<R: Reader, W: Writer> TeeReader<R, W> { #[deprecated(since = "1.0.0", reason = "use std::io::Tee instead")] #[unstable(feature = "old_io")] impl<R: Reader, W: Writer> Reader for TeeReader<R, W> { - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { self.reader.read(buf).and_then(|len| { self.writer.write_all(&mut buf[..len]).map(|()| len) }) @@ -307,7 +307,7 @@ impl<T: Iterator<Item=u8>> IterReader<T> { impl<T: Iterator<Item=u8>> Reader for IterReader<T> { #[inline] - fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<uint> { + fn read(&mut self, buf: &mut [u8]) -> old_io::IoResult<usize> { let mut len = 0; for (slot, elt) in buf.iter_mut().zip(self.iter.by_ref()) { *slot = elt; @@ -392,8 +392,8 @@ mod test { #[test] fn test_multi_writer() { - static mut writes: uint = 0; - static mut flushes: uint = 0; + static mut writes: usize = 0; + static mut flushes: usize = 0; struct TestWriter; impl Writer for TestWriter { |
