Skip to content

Commit 3055179

Browse files
committed
---
yaml --- r: 143794 b: refs/heads/try2 c: 17e0089 h: refs/heads/master v: v3
1 parent 31abd88 commit 3055179

File tree

2 files changed

+7
-14
lines changed

2 files changed

+7
-14
lines changed

[refs]

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ refs/heads/snap-stage3: 78a7676898d9f80ab540c6df5d4c9ce35bb50463
55
refs/heads/try: 519addf6277dbafccbb4159db4b710c37eaa2ec5
66
refs/tags/release-0.1: 1f5c5126e96c79d22cb7862f75304136e204f105
77
refs/heads/ndm: f3868061cd7988080c30d6d5bf352a5a5fe2460b
8-
refs/heads/try2: 3629f702e91ab1b34a556ecc34c6a5c89e0aae0c
8+
refs/heads/try2: 17e0089856de145b10485c9a96bcf4f39e5b7f71
99
refs/heads/dist-snap: ba4081a5a8573875fed17545846f6f6902c8ba8d
1010
refs/tags/release-0.2: c870d2dffb391e14efb05aa27898f1f6333a9596
1111
refs/tags/release-0.3: b5f0d0f648d9a6153664837026ba1be43d3e2503

branches/try2/src/libstd/os.rs

Lines changed: 6 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929
#[allow(missing_doc)];
3030

3131
use c_str::ToCStr;
32-
use cast;
3332
use clone::Clone;
3433
use container::Container;
3534
use io;
@@ -246,10 +245,10 @@ pub fn getenv(n: &str) -> Option<~str> {
246245
let s = do n.to_c_str().with_ref |buf| {
247246
libc::getenv(buf)
248247
};
249-
if ptr::null::<u8>() == cast::transmute(s) {
248+
if s.is_null() {
250249
None
251250
} else {
252-
Some(str::raw::from_buf(cast::transmute(s)))
251+
Some(str::raw::from_c_str(s))
253252
}
254253
}
255254
}
@@ -643,8 +642,7 @@ pub fn make_dir(p: &Path, mode: c_int) -> bool {
643642
use os::win32::as_utf16_p;
644643
// FIXME: turn mode into something useful? #2623
645644
do as_utf16_p(p.to_str()) |buf| {
646-
libc::CreateDirectoryW(buf, cast::transmute(0))
647-
!= (0 as libc::BOOL)
645+
libc::CreateDirectoryW(buf, ptr::null()) != (0 as libc::BOOL)
648646
}
649647
}
650648
}
@@ -748,10 +746,7 @@ pub fn list_dir(p: &Path) -> ~[~str] {
748746
do as_utf16_p(star(p).to_str()) |path_ptr| {
749747
let mut strings = ~[];
750748
let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint);
751-
let find_handle =
752-
FindFirstFileW(
753-
path_ptr,
754-
::cast::transmute(wfd_ptr));
749+
let find_handle = FindFirstFileW(path_ptr, wfd_ptr as HANDLE);
755750
if find_handle as libc::c_int != INVALID_HANDLE_VALUE {
756751
let mut more_files = 1 as libc::c_int;
757752
while more_files != 0 {
@@ -765,9 +760,7 @@ pub fn list_dir(p: &Path) -> ~[~str] {
765760
let fp_str = str::from_utf16(fp_vec);
766761
strings.push(fp_str);
767762
}
768-
more_files = FindNextFileW(
769-
find_handle,
770-
::cast::transmute(wfd_ptr));
763+
more_files = FindNextFileW(find_handle, wfd_ptr as HANDLE);
771764
}
772765
FindClose(find_handle);
773766
free(wfd_ptr)
@@ -1195,7 +1188,7 @@ pub fn real_args() -> ~[~str] {
11951188
}
11961189

11971190
unsafe {
1198-
LocalFree(cast::transmute(szArgList));
1191+
LocalFree(szArgList as *c_void);
11991192
}
12001193

12011194
return args;

0 commit comments

Comments
 (0)