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/sys/common | |
| 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/sys/common')
| -rw-r--r-- | src/libstd/sys/common/backtrace.rs | 8 | ||||
| -rw-r--r-- | src/libstd/sys/common/helper_thread.rs | 14 | ||||
| -rw-r--r-- | src/libstd/sys/common/mod.rs | 12 | ||||
| -rw-r--r-- | src/libstd/sys/common/net.rs | 58 | ||||
| -rw-r--r-- | src/libstd/sys/common/stack.rs | 50 | ||||
| -rw-r--r-- | src/libstd/sys/common/thread_info.rs | 6 | ||||
| -rw-r--r-- | src/libstd/sys/common/thread_local.rs | 14 | ||||
| -rw-r--r-- | src/libstd/sys/common/wtf8.rs | 34 |
8 files changed, 98 insertions, 98 deletions
diff --git a/src/libstd/sys/common/backtrace.rs b/src/libstd/sys/common/backtrace.rs index c42a755b444..cd118b3c9ee 100644 --- a/src/libstd/sys/common/backtrace.rs +++ b/src/libstd/sys/common/backtrace.rs @@ -14,10 +14,10 @@ use io::prelude::*; use io; #[cfg(target_pointer_width = "64")] -pub const HEX_WIDTH: uint = 18; +pub const HEX_WIDTH: usize = 18; #[cfg(target_pointer_width = "32")] -pub const HEX_WIDTH: uint = 10; +pub const HEX_WIDTH: usize = 10; // All rust symbols are in theory lists of "::"-separated identifiers. Some // assemblers, however, can't handle these characters in symbol names. To get @@ -57,7 +57,7 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> { let mut i = 0; for c in chars.by_ref() { if c.is_numeric() { - i = i * 10 + c as uint - '0' as uint; + i = i * 10 + c as usize - '0' as usize; } else { break } @@ -86,7 +86,7 @@ pub fn demangle(writer: &mut Write, s: &str) -> io::Result<()> { while rest.char_at(0).is_numeric() { rest = &rest[1..]; } - let i: uint = inner[.. (inner.len() - rest.len())].parse().unwrap(); + let i: usize = inner[.. (inner.len() - rest.len())].parse().unwrap(); inner = &rest[i..]; rest = &rest[..i]; while rest.len() > 0 { diff --git a/src/libstd/sys/common/helper_thread.rs b/src/libstd/sys/common/helper_thread.rs index 10077dfd1b8..34a58f6c83a 100644 --- a/src/libstd/sys/common/helper_thread.rs +++ b/src/libstd/sys/common/helper_thread.rs @@ -51,7 +51,7 @@ pub struct Helper<M:Send> { pub chan: UnsafeCell<*mut Sender<M>>, /// OS handle used to wake up a blocked helper thread - pub signal: UnsafeCell<uint>, + pub signal: UnsafeCell<usize>, /// Flag if this helper thread has booted and been initialized yet. pub initialized: UnsafeCell<bool>, @@ -96,11 +96,11 @@ impl<M: Send> Helper<M> { { unsafe { let _guard = self.lock.lock().unwrap(); - if *self.chan.get() as uint == 0 { + if *self.chan.get() as usize == 0 { let (tx, rx) = channel(); *self.chan.get() = boxed::into_raw(box tx); let (receive, send) = helper_signal::new(); - *self.signal.get() = send as uint; + *self.signal.get() = send as usize; let receive = RaceBox(receive); @@ -114,7 +114,7 @@ impl<M: Send> Helper<M> { let _ = rt::at_exit(move || { self.shutdown() }); *self.initialized.get() = true; - } else if *self.chan.get() as uint == 1 { + } else if *self.chan.get() as usize == 1 { panic!("cannot continue usage after shutdown"); } } @@ -130,8 +130,8 @@ impl<M: Send> Helper<M> { // Must send and *then* signal to ensure that the child receives the // message. Otherwise it could wake up and go to sleep before we // send the message. - assert!(*self.chan.get() as uint != 0); - assert!(*self.chan.get() as uint != 1, + assert!(*self.chan.get() as usize != 0); + assert!(*self.chan.get() as usize != 1, "cannot continue usage after shutdown"); (**self.chan.get()).send(msg).unwrap(); helper_signal::signal(*self.signal.get() as helper_signal::signal); @@ -146,7 +146,7 @@ impl<M: Send> Helper<M> { let mut guard = self.lock.lock().unwrap(); let ptr = *self.chan.get(); - if ptr as uint == 1 { + if ptr as usize == 1 { panic!("cannot continue usage after shutdown"); } // Close the channel by destroying it diff --git a/src/libstd/sys/common/mod.rs b/src/libstd/sys/common/mod.rs index 29c05b1e0d8..a8769ba99e8 100644 --- a/src/libstd/sys/common/mod.rs +++ b/src/libstd/sys/common/mod.rs @@ -56,7 +56,7 @@ pub fn timeout(desc: &'static str) -> IoError { } #[allow(deprecated)] -pub fn short_write(n: uint, desc: &'static str) -> IoError { +pub fn short_write(n: usize, desc: &'static str) -> IoError { IoError { kind: if n == 0 { old_io::TimedOut } else { old_io::ShortWrite(n) }, desc: desc, @@ -84,7 +84,7 @@ pub fn mkerr_libc<T: Int>(ret: T) -> IoResult<()> { } pub fn keep_going<F>(data: &[u8], mut f: F) -> i64 where - F: FnMut(*const u8, uint) -> i64, + F: FnMut(*const u8, usize) -> i64, { let origamt = data.len(); let mut data = data.as_ptr(); @@ -94,8 +94,8 @@ pub fn keep_going<F>(data: &[u8], mut f: F) -> i64 where if ret == 0 { break } else if ret != -1 { - amt -= ret as uint; - data = unsafe { data.offset(ret as int) }; + amt -= ret as usize; + data = unsafe { data.offset(ret as isize) }; } else { return ret; } @@ -134,7 +134,7 @@ pub trait ProcessConfig<K: BytesContainer, V: BytesContainer> { fn args(&self) -> &[CString]; fn env(&self) -> Option<&collections::HashMap<K, V>>; fn cwd(&self) -> Option<&CString>; - fn uid(&self) -> Option<uint>; - fn gid(&self) -> Option<uint>; + fn uid(&self) -> Option<usize>; + fn gid(&self) -> Option<usize>; fn detach(&self) -> bool; } diff --git a/src/libstd/sys/common/net.rs b/src/libstd/sys/common/net.rs index 96b72b42e54..1a0ee17904a 100644 --- a/src/libstd/sys/common/net.rs +++ b/src/libstd/sys/common/net.rs @@ -148,7 +148,7 @@ pub fn getsockopt<T: Copy>(fd: sock_t, opt: libc::c_int, if ret != 0 { Err(last_net_error()) } else { - assert!(len as uint == mem::size_of::<T>()); + assert!(len as usize == mem::size_of::<T>()); Ok(slot) } } @@ -170,14 +170,14 @@ pub fn sockname(fd: sock_t, return Err(last_net_error()) } } - return sockaddr_to_addr(&storage, len as uint); + return sockaddr_to_addr(&storage, len as usize); } pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage, - len: uint) -> IoResult<SocketAddr> { + len: usize) -> IoResult<SocketAddr> { match storage.ss_family as libc::c_int { libc::AF_INET => { - assert!(len as uint >= mem::size_of::<libc::sockaddr_in>()); + assert!(len as usize >= mem::size_of::<libc::sockaddr_in>()); let storage: &libc::sockaddr_in = unsafe { mem::transmute(storage) }; @@ -192,7 +192,7 @@ pub fn sockaddr_to_addr(storage: &libc::sockaddr_storage, }) } libc::AF_INET6 => { - assert!(len as uint >= mem::size_of::<libc::sockaddr_in6>()); + assert!(len as usize >= mem::size_of::<libc::sockaddr_in6>()); let storage: &libc::sockaddr_in6 = unsafe { mem::transmute(storage) }; @@ -283,13 +283,13 @@ pub fn get_host_addresses(host: Option<&str>, servname: Option<&str>, while !rp.is_null() { unsafe { let addr = try!(sockaddr_to_addr(mem::transmute((*rp).ai_addr), - (*rp).ai_addrlen as uint)); + (*rp).ai_addrlen as usize)); addrs.push(addrinfo::Info { address: addr, - family: (*rp).ai_family as uint, + family: (*rp).ai_family as usize, socktype: None, protocol: None, - flags: (*rp).ai_flags as uint + flags: (*rp).ai_flags as usize }); rp = (*rp).ai_next as *mut libc::addrinfo; @@ -312,7 +312,7 @@ extern "system" { flags: c_int) -> c_int; } -const NI_MAXHOST: uint = 1025; +const NI_MAXHOST: usize = 1025; pub fn get_address_name(addr: IpAddr) -> Result<String, IoError> { let addr = SocketAddr{ip: addr, port: 0}; @@ -393,7 +393,7 @@ pub fn get_address_name(addr: IpAddr) -> Result<String, IoError> { // [1] http://twistedmatrix.com/pipermail/twisted-commits/2012-April/034692.html // [2] http://stackoverflow.com/questions/19819198/does-send-msg-dontwait -pub fn read<T, L, R>(fd: sock_t, deadline: u64, mut lock: L, mut read: R) -> IoResult<uint> where +pub fn read<T, L, R>(fd: sock_t, deadline: u64, mut lock: L, mut read: R) -> IoResult<usize> where L: FnMut() -> T, R: FnMut(bool) -> libc::c_int, { @@ -431,7 +431,7 @@ pub fn read<T, L, R>(fd: sock_t, deadline: u64, mut lock: L, mut read: R) -> IoR match ret { 0 => Err(sys_common::eof()), n if n < 0 => Err(last_net_error()), - n => Ok(n as uint) + n => Ok(n as usize) } } @@ -440,9 +440,9 @@ pub fn write<T, L, W>(fd: sock_t, buf: &[u8], write_everything: bool, mut lock: L, - mut write: W) -> IoResult<uint> where + mut write: W) -> IoResult<usize> where L: FnMut() -> T, - W: FnMut(bool, *const u8, uint) -> i64, + W: FnMut(bool, *const u8, usize) -> i64, { let mut ret = -1; let mut written = 0; @@ -454,7 +454,7 @@ pub fn write<T, L, W>(fd: sock_t, }); } else { ret = retry(|| { write(false, buf.as_ptr(), buf.len()) }); - if ret > 0 { written = ret as uint; } + if ret > 0 { written = ret as usize; } } } @@ -483,7 +483,7 @@ pub fn write<T, L, W>(fd: sock_t, match retry(|| write(deadline.is_some(), ptr, len)) { -1 if wouldblock() => {} -1 => return Err(last_net_error()), - n => { written += n as uint; } + n => { written += n as usize; } } } ret = 0; @@ -513,8 +513,8 @@ pub fn connect_timeout(fd: sock_t, // If the connection is in progress, then we need to wait for it to // finish (with a timeout). The current strategy for doing this is // to use select() with a timeout. - -1 if os::errno() as int == INPROGRESS as int || - os::errno() as int == WOULDBLOCK as int => { + -1 if os::errno() as isize == INPROGRESS as isize || + os::errno() as isize == WOULDBLOCK as isize => { let mut set: c::fd_set = unsafe { mem::zeroed() }; c::fd_set(&mut set, fd); match await(fd, &mut set, timeout_ms) { @@ -686,7 +686,7 @@ impl TcpStream { nodelay as libc::c_int) } - pub fn set_keepalive(&mut self, seconds: Option<uint>) -> IoResult<()> { + pub fn set_keepalive(&mut self, seconds: Option<usize>) -> IoResult<()> { let ret = setsockopt(self.fd(), libc::SOL_SOCKET, libc::SO_KEEPALIVE, seconds.is_some() as libc::c_int); match seconds { @@ -696,18 +696,18 @@ impl TcpStream { } #[cfg(any(target_os = "macos", target_os = "ios"))] - fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> { + fn set_tcp_keepalive(&mut self, seconds: usize) -> IoResult<()> { setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPALIVE, seconds as libc::c_int) } #[cfg(any(target_os = "freebsd", target_os = "dragonfly"))] - fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> { + fn set_tcp_keepalive(&mut self, seconds: usize) -> IoResult<()> { setsockopt(self.fd(), libc::IPPROTO_TCP, libc::TCP_KEEPIDLE, seconds as libc::c_int) } #[cfg(target_os = "openbsd")] - fn set_tcp_keepalive(&mut self, seconds: uint) -> IoResult<()> { + fn set_tcp_keepalive(&mut self, seconds: usize) -> IoResult<()> { setsockopt(self.fd(), libc::IPPROTO_TCP, libc::SO_KEEPALIVE, seconds as libc::c_int) } @@ -716,7 +716,7 @@ impl TcpStream { target_os = "freebsd", target_os = "dragonfly", target_os = "openbsd")))] - fn set_tcp_keepalive(&mut self, _seconds: uint) -> IoResult<()> { + fn set_tcp_keepalive(&mut self, _seconds: usize) -> IoResult<()> { Ok(()) } @@ -733,7 +733,7 @@ impl TcpStream { ret } - pub fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> { + pub fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> { let fd = self.fd(); let dolock = || self.lock_nonblocking(); let doread = |nb| unsafe { @@ -749,7 +749,7 @@ impl TcpStream { pub fn write(&mut self, buf: &[u8]) -> IoResult<()> { let fd = self.fd(); let dolock = || self.lock_nonblocking(); - let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe { + let dowrite = |nb: bool, buf: *const u8, len: usize| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::send(fd, buf as *const _, @@ -876,7 +876,7 @@ impl UdpSocket { sockname(self.fd(), libc::getsockname) } - pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(uint, SocketAddr)> { + pub fn recv_from(&mut self, buf: &mut [u8]) -> IoResult<(usize, SocketAddr)> { let fd = self.fd(); let mut storage: libc::sockaddr_storage = unsafe { mem::zeroed() }; let storagep = &mut storage as *mut _ as *mut libc::sockaddr; @@ -893,7 +893,7 @@ impl UdpSocket { storagep, &mut addrlen) as libc::c_int })); - Ok((n as uint, sockaddr_to_addr(&storage, addrlen as uint).unwrap())) + Ok((n as usize, sockaddr_to_addr(&storage, addrlen as usize).unwrap())) } pub fn send_to(&mut self, buf: &[u8], dst: SocketAddr) -> IoResult<()> { @@ -903,7 +903,7 @@ impl UdpSocket { let fd = self.fd(); let dolock = || self.lock_nonblocking(); - let dowrite = |nb, buf: *const u8, len: uint| unsafe { + let dowrite = |nb, buf: *const u8, len: usize| unsafe { let flags = if nb {c::MSG_DONTWAIT} else {0}; libc::sendto(fd, buf as *const libc::c_void, @@ -939,11 +939,11 @@ impl UdpSocket { } } - pub fn multicast_time_to_live(&mut self, ttl: int) -> IoResult<()> { + pub fn multicast_time_to_live(&mut self, ttl: isize) -> IoResult<()> { setsockopt(self.fd(), libc::IPPROTO_IP, libc::IP_MULTICAST_TTL, ttl as libc::c_int) } - pub fn time_to_live(&mut self, ttl: int) -> IoResult<()> { + pub fn time_to_live(&mut self, ttl: isize) -> IoResult<()> { setsockopt(self.fd(), libc::IPPROTO_IP, libc::IP_TTL, ttl as libc::c_int) } diff --git a/src/libstd/sys/common/stack.rs b/src/libstd/sys/common/stack.rs index 8c428275ccf..8dc3407db77 100644 --- a/src/libstd/sys/common/stack.rs +++ b/src/libstd/sys/common/stack.rs @@ -46,7 +46,7 @@ // corresponding prolog, decision was taken to disable segmented // stack support on iOS. -pub const RED_ZONE: uint = 20 * 1024; +pub const RED_ZONE: usize = 20 * 1024; /// This function is invoked from rust's current __morestack function. Segmented /// stacks are currently not enabled as segmented stacks, but rather one giant @@ -117,7 +117,7 @@ extern fn stack_exhausted() { // On all other platforms both variants behave identically. #[inline(always)] -pub unsafe fn record_os_managed_stack_bounds(stack_lo: uint, _stack_hi: uint) { +pub unsafe fn record_os_managed_stack_bounds(stack_lo: usize, _stack_hi: usize) { record_sp_limit(stack_lo + RED_ZONE); } @@ -136,31 +136,31 @@ pub unsafe fn record_os_managed_stack_bounds(stack_lo: uint, _stack_hi: uint) { /// would be unfortunate for the functions themselves to trigger a morestack /// invocation (if they were an actual function call). #[inline(always)] -pub unsafe fn record_sp_limit(limit: uint) { +pub unsafe fn record_sp_limit(limit: usize) { return target_record_sp_limit(limit); // x86-64 #[cfg(all(target_arch = "x86_64", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $$0x60+90*8, %rsi movq $0, %gs:(%rsi)" :: "r"(limit) : "rsi" : "volatile") } #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $0, %fs:112" :: "r"(limit) :: "volatile") } #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)] - unsafe fn target_record_sp_limit(_: uint) { + unsafe fn target_record_sp_limit(_: usize) { } #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $0, %fs:24" :: "r"(limit) :: "volatile") } #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movq $0, %fs:32" :: "r"(limit) :: "volatile") } @@ -168,18 +168,18 @@ pub unsafe fn record_sp_limit(limit: uint) { #[cfg(all(target_arch = "x86", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movl $$0x48+90*4, %eax movl $0, %gs:(%eax)" :: "r"(limit) : "eax" : "volatile") } #[cfg(all(target_arch = "x86", any(target_os = "linux", target_os = "freebsd")))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { asm!("movl $0, %gs:48" :: "r"(limit) :: "volatile") } #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)] - unsafe fn target_record_sp_limit(_: uint) { + unsafe fn target_record_sp_limit(_: usize) { } // mips, arm - Some brave soul can port these to inline asm, but it's over @@ -188,7 +188,7 @@ pub unsafe fn record_sp_limit(limit: uint) { target_arch = "mipsel", all(target_arch = "arm", not(target_os = "ios"))))] #[inline(always)] - unsafe fn target_record_sp_limit(limit: uint) { + unsafe fn target_record_sp_limit(limit: usize) { use libc::c_void; return record_sp_limit(limit as *const c_void); extern { @@ -205,7 +205,7 @@ pub unsafe fn record_sp_limit(limit: uint) { all(target_arch = "arm", target_os = "ios"), target_os = "bitrig", target_os = "openbsd"))] - unsafe fn target_record_sp_limit(_: uint) { + unsafe fn target_record_sp_limit(_: usize) { } } @@ -218,38 +218,38 @@ pub unsafe fn record_sp_limit(limit: uint) { /// As with the setter, this function does not have a __morestack header and can /// therefore be called in a "we're out of stack" situation. #[inline(always)] -pub unsafe fn get_sp_limit() -> uint { +pub unsafe fn get_sp_limit() -> usize { return target_get_sp_limit(); // x86-64 #[cfg(all(target_arch = "x86_64", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq $$0x60+90*8, %rsi movq %gs:(%rsi), $0" : "=r"(limit) :: "rsi" : "volatile"); return limit; } #[cfg(all(target_arch = "x86_64", target_os = "linux"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq %fs:112, $0" : "=r"(limit) ::: "volatile"); return limit; } #[cfg(all(target_arch = "x86_64", target_os = "windows"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { return 1024; } #[cfg(all(target_arch = "x86_64", target_os = "freebsd"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq %fs:24, $0" : "=r"(limit) ::: "volatile"); return limit; } #[cfg(all(target_arch = "x86_64", target_os = "dragonfly"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movq %fs:32, $0" : "=r"(limit) ::: "volatile"); return limit; @@ -259,7 +259,7 @@ pub unsafe fn get_sp_limit() -> uint { #[cfg(all(target_arch = "x86", any(target_os = "macos", target_os = "ios")))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movl $$0x48+90*4, %eax movl %gs:(%eax), $0" : "=r"(limit) :: "eax" : "volatile"); @@ -268,13 +268,13 @@ pub unsafe fn get_sp_limit() -> uint { #[cfg(all(target_arch = "x86", any(target_os = "linux", target_os = "freebsd")))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { let limit; asm!("movl %gs:48, $0" : "=r"(limit) ::: "volatile"); return limit; } #[cfg(all(target_arch = "x86", target_os = "windows"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { return 1024; } @@ -284,9 +284,9 @@ pub unsafe fn get_sp_limit() -> uint { target_arch = "mipsel", all(target_arch = "arm", not(target_os = "ios"))))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { use libc::c_void; - return get_sp_limit() as uint; + return get_sp_limit() as usize; extern { fn get_sp_limit() -> *const c_void; } @@ -305,7 +305,7 @@ pub unsafe fn get_sp_limit() -> uint { target_os = "bitrig", target_os = "openbsd"))] #[inline(always)] - unsafe fn target_get_sp_limit() -> uint { + unsafe fn target_get_sp_limit() -> usize { 1024 } } diff --git a/src/libstd/sys/common/thread_info.rs b/src/libstd/sys/common/thread_info.rs index 90526b8f4f3..22cb5943371 100644 --- a/src/libstd/sys/common/thread_info.rs +++ b/src/libstd/sys/common/thread_info.rs @@ -18,7 +18,7 @@ use thread::Thread; use thread::LocalKeyState; struct ThreadInfo { - stack_guard: uint, + stack_guard: usize, thread: Thread, } @@ -47,11 +47,11 @@ pub fn current_thread() -> Thread { ThreadInfo::with(|info| info.thread.clone()) } -pub fn stack_guard() -> uint { +pub fn stack_guard() -> usize { ThreadInfo::with(|info| info.stack_guard) } -pub fn set(stack_guard: uint, thread: Thread) { +pub fn set(stack_guard: usize, thread: Thread) { THREAD_INFO.with(|c| assert!(c.borrow().is_none())); THREAD_INFO.with(move |c| *c.borrow_mut() = Some(ThreadInfo{ stack_guard: stack_guard, diff --git a/src/libstd/sys/common/thread_local.rs b/src/libstd/sys/common/thread_local.rs index 5e2a138fa63..5995d7ac10f 100644 --- a/src/libstd/sys/common/thread_local.rs +++ b/src/libstd/sys/common/thread_local.rs @@ -178,7 +178,7 @@ impl StaticKey { } } - unsafe fn lazy_init(&self) -> uint { + unsafe fn lazy_init(&self) -> usize { // POSIX allows the key created here to be 0, but the compare_and_swap // below relies on using 0 as a sentinel value to check who won the // race to set the shared TLS key. As far as I know, there is no @@ -197,9 +197,9 @@ impl StaticKey { key2 }; assert!(key != 0); - match self.inner.key.compare_and_swap(0, key as uint, Ordering::SeqCst) { + match self.inner.key.compare_and_swap(0, key as usize, Ordering::SeqCst) { // The CAS succeeded, so we've created the actual key - 0 => key as uint, + 0 => key as usize, // If someone beat us to the punch, use their key instead n => { imp::destroy(key); n } } @@ -261,8 +261,8 @@ mod tests { assert!(k2.get().is_null()); k1.set(1 as *mut _); k2.set(2 as *mut _); - assert_eq!(k1.get() as uint, 1); - assert_eq!(k2.get() as uint, 2); + assert_eq!(k1.get() as usize, 1); + assert_eq!(k2.get() as usize, 2); } #[test] @@ -275,8 +275,8 @@ mod tests { assert!(K2.get().is_null()); K1.set(1 as *mut _); K2.set(2 as *mut _); - assert_eq!(K1.get() as uint, 1); - assert_eq!(K2.get() as uint, 2); + assert_eq!(K1.get() as usize, 1); + assert_eq!(K2.get() as usize, 2); } } } diff --git a/src/libstd/sys/common/wtf8.rs b/src/libstd/sys/common/wtf8.rs index 9f3dae34c7a..7efe7d96b71 100644 --- a/src/libstd/sys/common/wtf8.rs +++ b/src/libstd/sys/common/wtf8.rs @@ -158,7 +158,7 @@ impl Wtf8Buf { /// Create an new, empty WTF-8 string with pre-allocated capacity for `n` bytes. #[inline] - pub fn with_capacity(n: uint) -> Wtf8Buf { + pub fn with_capacity(n: usize) -> Wtf8Buf { Wtf8Buf { bytes: Vec::with_capacity(n) } } @@ -214,7 +214,7 @@ impl Wtf8Buf { // Attempt to not use an intermediate buffer by just pushing bytes // directly onto this string. let slice = slice::from_raw_parts_mut( - self.bytes.as_mut_ptr().offset(cur_len as int), + self.bytes.as_mut_ptr().offset(cur_len as isize), 4 ); let used = encode_utf8_raw(code_point.value, mem::transmute(slice)) @@ -234,15 +234,15 @@ impl Wtf8Buf { /// /// # Panics /// - /// Panics if the new capacity overflows `uint`. + /// Panics if the new capacity overflows `usize`. #[inline] - pub fn reserve(&mut self, additional: uint) { + pub fn reserve(&mut self, additional: usize) { self.bytes.reserve(additional) } /// Returns the number of bytes that this string buffer can hold without reallocating. #[inline] - pub fn capacity(&self) -> uint { + pub fn capacity(&self) -> usize { self.bytes.capacity() } @@ -313,7 +313,7 @@ impl Wtf8Buf { /// Panics if `new_len` > current length, /// or if `new_len` is not a code point boundary. #[inline] - pub fn truncate(&mut self, new_len: uint) { + pub fn truncate(&mut self, new_len: usize) { assert!(is_code_point_boundary(self, new_len)); self.bytes.truncate(new_len) } @@ -463,7 +463,7 @@ impl Wtf8 { /// Return the length, in WTF-8 bytes. #[inline] - pub fn len(&self) -> uint { + pub fn len(&self) -> usize { self.bytes.len() } @@ -474,7 +474,7 @@ impl Wtf8 { /// /// Panics if `position` is beyond the end of the string. #[inline] - pub fn ascii_byte_at(&self, position: uint) -> u8 { + pub fn ascii_byte_at(&self, position: usize) -> u8 { match self.bytes[position] { ascii_byte @ 0x00 ... 0x7F => ascii_byte, _ => 0xFF @@ -488,7 +488,7 @@ impl Wtf8 { /// Panics if `position` is not at a code point boundary, /// or is beyond the end of the string. #[inline] - pub fn code_point_at(&self, position: uint) -> CodePoint { + pub fn code_point_at(&self, position: usize) -> CodePoint { let (code_point, _) = self.code_point_range_at(position); code_point } @@ -501,7 +501,7 @@ impl Wtf8 { /// Panics if `position` is not at a code point boundary, /// or is beyond the end of the string. #[inline] - pub fn code_point_range_at(&self, position: uint) -> (CodePoint, uint) { + pub fn code_point_range_at(&self, position: usize) -> (CodePoint, usize) { let (c, n) = char_range_at_raw(&self.bytes, position); (CodePoint { value: c }, n) } @@ -570,7 +570,7 @@ impl Wtf8 { } #[inline] - fn next_surrogate(&self, mut pos: uint) -> Option<(uint, u16)> { + fn next_surrogate(&self, mut pos: usize) -> Option<(usize, u16)> { let mut iter = self.bytes[pos..].iter(); loop { let b = match iter.next() { @@ -792,7 +792,7 @@ fn decode_surrogate_pair(lead: u16, trail: u16) -> char { /// Copied from core::str::StrPrelude::is_char_boundary #[inline] -pub fn is_code_point_boundary(slice: &Wtf8, index: uint) -> bool { +pub fn is_code_point_boundary(slice: &Wtf8, index: usize) -> bool { if index == slice.len() { return true; } match slice.bytes.get(index) { None => false, @@ -802,17 +802,17 @@ pub fn is_code_point_boundary(slice: &Wtf8, index: uint) -> bool { /// Copied from core::str::raw::slice_unchecked #[inline] -pub unsafe fn slice_unchecked(s: &Wtf8, begin: uint, end: uint) -> &Wtf8 { +pub unsafe fn slice_unchecked(s: &Wtf8, begin: usize, end: usize) -> &Wtf8 { // memory layout of an &[u8] and &Wtf8 are the same mem::transmute(slice::from_raw_parts( - s.bytes.as_ptr().offset(begin as int), + s.bytes.as_ptr().offset(begin as isize), end - begin )) } /// Copied from core::str::raw::slice_error_fail #[inline(never)] -pub fn slice_error_fail(s: &Wtf8, begin: uint, end: uint) -> ! { +pub fn slice_error_fail(s: &Wtf8, begin: usize, end: usize) -> ! { assert!(begin <= end); panic!("index {} and/or {} in `{:?}` do not lie on character boundary", begin, end, s); @@ -835,7 +835,7 @@ impl<'a> Iterator for Wtf8CodePoints<'a> { } #[inline] - fn size_hint(&self) -> (uint, Option<uint>) { + fn size_hint(&self) -> (usize, Option<usize>) { let (len, _) = self.bytes.size_hint(); (len.saturating_add(3) / 4, Some(len)) } @@ -869,7 +869,7 @@ impl<'a> Iterator for EncodeWide<'a> { } #[inline] - fn size_hint(&self) -> (uint, Option<uint>) { + fn size_hint(&self) -> (usize, Option<usize>) { let (low, high) = self.code_points.size_hint(); // every code point gets either one u16 or two u16, // so this iterator is between 1 or 2 times as |
