diff options
| author | bors <bors@rust-lang.org> | 2014-01-22 23:26:33 -0800 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2014-01-22 23:26:33 -0800 |
| commit | 19e0cbe420f7a78077b8009fdf1367073fc0c5eb (patch) | |
| tree | 10232b5958cac95aa3a437791661333f8e1818c1 /src/libnative | |
| parent | 52ba3b6414fe91cf92222581cb24e06894267c49 (diff) | |
| parent | b2ec71fc277ca590bb8bd26d3f7762d6406860e5 (diff) | |
| download | rust-19e0cbe420f7a78077b8009fdf1367073fc0c5eb.tar.gz rust-19e0cbe420f7a78077b8009fdf1367073fc0c5eb.zip | |
auto merge of #11682 : thestinger/rust/vector, r=brson
This is just an initial implementation and does not yet fully replace `~[T]`. A generic initialization syntax for containers is missing, and the slice functionality needs to be reworked to make auto-slicing unnecessary. Traits for supporting indexing properly are also required. This also needs to be fixed to make ring buffers as easy to use as vectors. The tests and documentation for `~[T]` can be ported over to this type when it is removed. I don't really expect DST to happen for vectors as having both `~[T]` and `Vec<T>` is overcomplicated and changing the slice representation to 3 words is not at all appealing. Unlike with traits, it's possible (and easy) to implement `RcSlice<T>` and `GcSlice<T>` without compiler help.
Diffstat (limited to 'src/libnative')
| -rw-r--r-- | src/libnative/io/file.rs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libnative/io/file.rs b/src/libnative/io/file.rs index af6ed51729e..af06533d44b 100644 --- a/src/libnative/io/file.rs +++ b/src/libnative/io/file.rs @@ -548,13 +548,13 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> { let p = Path::new(p); let star = p.join("*"); as_utf16_p(star.as_str().unwrap(), |path_ptr| { - let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint) as *c_void; + let wfd_ptr = malloc_raw(rust_list_dir_wfd_size() as uint); let find_handle = FindFirstFileW(path_ptr, wfd_ptr as HANDLE); if find_handle as libc::c_int != INVALID_HANDLE_VALUE { let mut paths = ~[]; let mut more_files = 1 as libc::c_int; while more_files != 0 { - let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr); + let fp_buf = rust_list_dir_wfd_fp_buf(wfd_ptr as *c_void); if fp_buf as uint == 0 { fail!("os::list_dir() failure: got null ptr from wfd"); } @@ -567,7 +567,7 @@ pub fn readdir(p: &CString) -> IoResult<~[Path]> { more_files = FindNextFileW(find_handle, wfd_ptr as HANDLE); } FindClose(find_handle); - free(wfd_ptr); + free(wfd_ptr as *mut c_void); Ok(paths) } else { Err(super::last_error()) |
