Windows and OS X fallout

This commit is contained in:
Nick Cameron 2014-11-18 13:49:09 +13:00
parent d46f7adb53
commit 225de0d60f
8 changed files with 22 additions and 22 deletions

View file

@ -263,7 +263,7 @@ pub fn readdir(p: &Path) -> IoResult<Vec<Path>> {
let mut more_files = 1 as libc::BOOL;
while more_files != 0 {
{
let filename = str::truncate_utf16_at_nul(wfd.cFileName);
let filename = str::truncate_utf16_at_nul(&wfd.cFileName);
match String::from_utf16(filename) {
Some(filename) => paths.push(Path::new(filename)),
None => {

View file

@ -76,7 +76,7 @@ pub fn error_string(errnum: i32) -> String {
return format!("OS Error {} (FormatMessageW() returned error {})", errnum, fm_err);
}
let msg = String::from_utf16(::str::truncate_utf16_at_nul(buf));
let msg = String::from_utf16(::str::truncate_utf16_at_nul(&buf));
match msg {
Some(msg) => format!("OS Error {}: {}", errnum, msg),
None => format!("OS Error {} (FormatMessageW() returned invalid UTF-16)", errnum),

View file

@ -395,7 +395,7 @@ impl UnixStream {
loop {
// Process a timeout if one is pending
let wait_succeeded = await(self.handle(), self.read_deadline,
[overlapped.hEvent]);
&[overlapped.hEvent]);
let ret = unsafe {
libc::GetOverlappedResult(self.handle(),
@ -459,7 +459,7 @@ impl UnixStream {
}
// Process a timeout if one is pending
let wait_succeeded = await(self.handle(), self.write_deadline,
[overlapped.hEvent]);
&[overlapped.hEvent]);
let ret = unsafe {
libc::GetOverlappedResult(self.handle(),
&mut overlapped,
@ -660,8 +660,8 @@ impl UnixAcceptor {
if err == libc::ERROR_IO_PENDING as libc::DWORD {
// Process a timeout if one is pending
let wait_succeeded = await(handle, self.deadline,
[self.inner.abort.handle(),
overlapped.hEvent]);
&[self.inner.abort.handle(),
overlapped.hEvent]);
// This will block until the overlapped I/O is completed. The
// timeout was previously handled, so this will either block in

View file

@ -487,24 +487,24 @@ mod tests {
}
assert_eq!(
test_wrapper("prog", ["aaa", "bbb", "ccc"]),
test_wrapper("prog", &["aaa", "bbb", "ccc"]),
"prog aaa bbb ccc".to_string()
);
assert_eq!(
test_wrapper("C:\\Program Files\\blah\\blah.exe", ["aaa"]),
test_wrapper("C:\\Program Files\\blah\\blah.exe", &["aaa"]),
"\"C:\\Program Files\\blah\\blah.exe\" aaa".to_string()
);
assert_eq!(
test_wrapper("C:\\Program Files\\test", ["aa\"bb"]),
test_wrapper("C:\\Program Files\\test", &["aa\"bb"]),
"\"C:\\Program Files\\test\" aa\\\"bb".to_string()
);
assert_eq!(
test_wrapper("echo", ["a b c"]),
test_wrapper("echo", &["a b c"]),
"echo \"a b c\"".to_string()
);
assert_eq!(
test_wrapper("\u03c0\u042f\u97f3\u00e6\u221e", []),
test_wrapper("\u03c0\u042f\u97f3\u00e6\u221e", &[]),
"\u03c0\u042f\u97f3\u00e6\u221e".to_string()
);
}