Test fixes and rebase conflicts
This commit is contained in:
parent
cb7599b83e
commit
470ae101d6
19 changed files with 38 additions and 41 deletions
|
|
@ -669,7 +669,7 @@ impl TcpStream {
|
|||
fn lock_nonblocking<'a>(&'a self) -> Guard<'a> {
|
||||
let ret = Guard {
|
||||
fd: self.fd(),
|
||||
guard: self.inner.lock.lock(),
|
||||
guard: self.inner.lock.lock().unwrap(),
|
||||
};
|
||||
assert!(set_nonblocking(self.fd(), true).is_ok());
|
||||
ret
|
||||
|
|
@ -808,7 +808,7 @@ impl UdpSocket {
|
|||
fn lock_nonblocking<'a>(&'a self) -> Guard<'a> {
|
||||
let ret = Guard {
|
||||
fd: self.fd(),
|
||||
guard: self.inner.lock.lock(),
|
||||
guard: self.inner.lock.lock().unwrap(),
|
||||
};
|
||||
assert!(set_nonblocking(self.fd(), true).is_ok());
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -145,7 +145,7 @@ impl UnixStream {
|
|||
fn lock_nonblocking<'a>(&'a self) -> Guard<'a> {
|
||||
let ret = Guard {
|
||||
fd: self.fd(),
|
||||
guard: unsafe { self.inner.lock.lock() },
|
||||
guard: unsafe { self.inner.lock.lock().unwrap() },
|
||||
};
|
||||
assert!(set_nonblocking(self.fd(), true).is_ok());
|
||||
ret
|
||||
|
|
|
|||
|
|
@ -131,7 +131,6 @@ extern "system" {
|
|||
|
||||
pub mod compat {
|
||||
use intrinsics::{atomic_store_relaxed, transmute};
|
||||
use iter::IteratorExt;
|
||||
use libc::types::os::arch::extra::{LPCWSTR, HMODULE, LPCSTR, LPVOID};
|
||||
use prelude::*;
|
||||
|
||||
|
|
|
|||
|
|
@ -265,8 +265,8 @@ pub fn readdir(p: &Path) -> IoResult<Vec<Path>> {
|
|||
{
|
||||
let filename = os::truncate_utf16_at_nul(&wfd.cFileName);
|
||||
match String::from_utf16(filename) {
|
||||
Some(filename) => paths.push(Path::new(filename)),
|
||||
None => {
|
||||
Ok(filename) => paths.push(Path::new(filename)),
|
||||
Err(..) => {
|
||||
assert!(libc::FindClose(find_handle) != 0);
|
||||
return Err(IoError {
|
||||
kind: io::InvalidInput,
|
||||
|
|
|
|||
|
|
@ -99,8 +99,9 @@ pub fn error_string(errnum: i32) -> String {
|
|||
|
||||
let msg = String::from_utf16(truncate_utf16_at_nul(&buf));
|
||||
match msg {
|
||||
Some(msg) => format!("OS Error {}: {}", errnum, msg),
|
||||
None => format!("OS Error {} (FormatMessageW() returned invalid UTF-16)", errnum),
|
||||
Ok(msg) => format!("OS Error {}: {}", errnum, msg),
|
||||
Err(..) => format!("OS Error {} (FormatMessageW() returned \
|
||||
invalid UTF-16)", errnum),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -147,7 +148,7 @@ pub fn fill_utf16_buf_and_decode(f: |*mut u16, DWORD| -> DWORD) -> Option<String
|
|||
// We want to explicitly catch the case when the
|
||||
// closure returned invalid UTF-16, rather than
|
||||
// set `res` to None and continue.
|
||||
let s = String::from_utf16(sub)
|
||||
let s = String::from_utf16(sub).ok()
|
||||
.expect("fill_utf16_buf_and_decode: closure created invalid UTF-16");
|
||||
res = Some(s)
|
||||
}
|
||||
|
|
@ -169,8 +170,8 @@ pub fn getcwd() -> IoResult<Path> {
|
|||
}
|
||||
|
||||
match String::from_utf16(truncate_utf16_at_nul(&buf)) {
|
||||
Some(ref cwd) => Ok(Path::new(cwd)),
|
||||
None => Err(IoError {
|
||||
Ok(ref cwd) => Ok(Path::new(cwd)),
|
||||
Err(..) => Err(IoError {
|
||||
kind: OtherIoError,
|
||||
desc: "GetCurrentDirectoryW returned invalid UTF-16",
|
||||
detail: None,
|
||||
|
|
|
|||
|
|
@ -101,8 +101,8 @@ impl TTY {
|
|||
};
|
||||
utf16.truncate(num as uint);
|
||||
let utf8 = match String::from_utf16(utf16.as_slice()) {
|
||||
Some(utf8) => utf8.into_bytes(),
|
||||
None => return Err(invalid_encoding()),
|
||||
Ok(utf8) => utf8.into_bytes(),
|
||||
Err(..) => return Err(invalid_encoding()),
|
||||
};
|
||||
self.utf8 = MemReader::new(utf8);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue