Skip to content

Commit 225de0d

Browse files
committed
Windows and OS X fallout
1 parent d46f7ad commit 225de0d

File tree

8 files changed

+22
-22
lines changed

8 files changed

+22
-22
lines changed

src/libstd/os.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ pub fn getcwd() -> Path {
140140
panic!();
141141
}
142142
}
143-
Path::new(String::from_utf16(::str::truncate_utf16_at_nul(buf))
143+
Path::new(String::from_utf16(::str::truncate_utf16_at_nul(&buf))
144144
.expect("GetCurrentDirectoryW returned invalid UTF-16"))
145145
}
146146

@@ -2065,12 +2065,12 @@ mod tests {
20652065
join_paths(input).unwrap().as_slice() == output.as_bytes()
20662066
}
20672067

2068-
assert!(test_eq([], ""));
2069-
assert!(test_eq([r"c:\windows", r"c:\"],
2068+
assert!(test_eq(&[], ""));
2069+
assert!(test_eq(&[r"c:\windows", r"c:\"],
20702070
r"c:\windows;c:\"));
2071-
assert!(test_eq(["", r"c:\windows", "", "", r"c:\", ""],
2071+
assert!(test_eq(&["", r"c:\windows", "", "", r"c:\", ""],
20722072
r";c:\windows;;;c:\;"));
2073-
assert!(test_eq([r"c:\te;st", r"c:\"],
2073+
assert!(test_eq(&[r"c:\te;st", r"c:\"],
20742074
r#""c:\te;st";c:\"#));
20752075
assert!(join_paths(&[r#"c:\te"st"#]).is_err());
20762076
}

src/libstd/rand/os.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -298,12 +298,12 @@ mod imp {
298298
impl Rng for OsRng {
299299
fn next_u32(&mut self) -> u32 {
300300
let mut v = [0u8, .. 4];
301-
self.fill_bytes(v);
301+
self.fill_bytes(&mut v);
302302
unsafe { mem::transmute(v) }
303303
}
304304
fn next_u64(&mut self) -> u64 {
305305
let mut v = [0u8, .. 8];
306-
self.fill_bytes(v);
306+
self.fill_bytes(&mut v);
307307
unsafe { mem::transmute(v) }
308308
}
309309
fn fill_bytes(&mut self, v: &mut [u8]) {

src/libstd/rt/backtrace.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -999,7 +999,7 @@ mod imp {
999999
None => try!(w.write(bytes[..bytes.len()-1])),
10001000
}
10011001
}
1002-
try!(w.write(['\n' as u8]));
1002+
try!(w.write(&['\n' as u8]));
10031003
}
10041004

10051005
Ok(())

src/libstd/sys/windows/fs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -263,7 +263,7 @@ pub fn readdir(p: &Path) -> IoResult<Vec<Path>> {
263263
let mut more_files = 1 as libc::BOOL;
264264
while more_files != 0 {
265265
{
266-
let filename = str::truncate_utf16_at_nul(wfd.cFileName);
266+
let filename = str::truncate_utf16_at_nul(&wfd.cFileName);
267267
match String::from_utf16(filename) {
268268
Some(filename) => paths.push(Path::new(filename)),
269269
None => {

src/libstd/sys/windows/os.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ pub fn error_string(errnum: i32) -> String {
7676
return format!("OS Error {} (FormatMessageW() returned error {})", errnum, fm_err);
7777
}
7878

79-
let msg = String::from_utf16(::str::truncate_utf16_at_nul(buf));
79+
let msg = String::from_utf16(::str::truncate_utf16_at_nul(&buf));
8080
match msg {
8181
Some(msg) => format!("OS Error {}: {}", errnum, msg),
8282
None => format!("OS Error {} (FormatMessageW() returned invalid UTF-16)", errnum),

src/libstd/sys/windows/pipe.rs

+4-4
Original file line numberDiff line numberDiff line change
@@ -395,7 +395,7 @@ impl UnixStream {
395395
loop {
396396
// Process a timeout if one is pending
397397
let wait_succeeded = await(self.handle(), self.read_deadline,
398-
[overlapped.hEvent]);
398+
&[overlapped.hEvent]);
399399

400400
let ret = unsafe {
401401
libc::GetOverlappedResult(self.handle(),
@@ -459,7 +459,7 @@ impl UnixStream {
459459
}
460460
// Process a timeout if one is pending
461461
let wait_succeeded = await(self.handle(), self.write_deadline,
462-
[overlapped.hEvent]);
462+
&[overlapped.hEvent]);
463463
let ret = unsafe {
464464
libc::GetOverlappedResult(self.handle(),
465465
&mut overlapped,
@@ -660,8 +660,8 @@ impl UnixAcceptor {
660660
if err == libc::ERROR_IO_PENDING as libc::DWORD {
661661
// Process a timeout if one is pending
662662
let wait_succeeded = await(handle, self.deadline,
663-
[self.inner.abort.handle(),
664-
overlapped.hEvent]);
663+
&[self.inner.abort.handle(),
664+
overlapped.hEvent]);
665665

666666
// This will block until the overlapped I/O is completed. The
667667
// timeout was previously handled, so this will either block in

src/libstd/sys/windows/process.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -487,24 +487,24 @@ mod tests {
487487
}
488488

489489
assert_eq!(
490-
test_wrapper("prog", ["aaa", "bbb", "ccc"]),
490+
test_wrapper("prog", &["aaa", "bbb", "ccc"]),
491491
"prog aaa bbb ccc".to_string()
492492
);
493493

494494
assert_eq!(
495-
test_wrapper("C:\\Program Files\\blah\\blah.exe", ["aaa"]),
495+
test_wrapper("C:\\Program Files\\blah\\blah.exe", &["aaa"]),
496496
"\"C:\\Program Files\\blah\\blah.exe\" aaa".to_string()
497497
);
498498
assert_eq!(
499-
test_wrapper("C:\\Program Files\\test", ["aa\"bb"]),
499+
test_wrapper("C:\\Program Files\\test", &["aa\"bb"]),
500500
"\"C:\\Program Files\\test\" aa\\\"bb".to_string()
501501
);
502502
assert_eq!(
503-
test_wrapper("echo", ["a b c"]),
503+
test_wrapper("echo", &["a b c"]),
504504
"echo \"a b c\"".to_string()
505505
);
506506
assert_eq!(
507-
test_wrapper("\u03c0\u042f\u97f3\u00e6\u221e", []),
507+
test_wrapper("\u03c0\u042f\u97f3\u00e6\u221e", &[]),
508508
"\u03c0\u042f\u97f3\u00e6\u221e".to_string()
509509
);
510510
}

src/test/run-pass/tcp-stress.rs

+3-3
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ fn main() {
4545
}
4646
};
4747
stream.read_byte();
48-
stream.write([2]);
48+
stream.write(&[2]);
4949
}
5050
});
5151
let addr = rx.recv();
@@ -57,9 +57,9 @@ fn main() {
5757
match TcpStream::connect(addr) {
5858
Ok(stream) => {
5959
let mut stream = stream;
60-
stream.write([1]);
60+
stream.write(&[1]);
6161
let mut buf = [0];
62-
stream.read(buf);
62+
stream.read(&mut buf);
6363
},
6464
Err(e) => debug!("{}", e)
6565
}

0 commit comments

Comments
 (0)