about summary refs log tree commit diff
path: root/src/libcore/io.rs
diff options
context:
space:
mode:
authorNiko Matsakis <niko@alum.mit.edu>2012-06-02 19:03:28 -0700
committerNiko Matsakis <niko@alum.mit.edu>2012-06-02 19:14:57 -0700
commit3f6e6532ac17e97ce48b91e07340361a32ef480b (patch)
tree8aba1f764b51f07fad2f41a67adbdae980023eb4 /src/libcore/io.rs
parente94683dce9832dddf5af5c5ffd1384c7fd113729 (diff)
make vec fns/methods take imm slices.
this also repairs the unsoundness in typing of unpack_slice,
which was silently converting a const ptr to an imm one.
Diffstat (limited to 'src/libcore/io.rs')
-rw-r--r--src/libcore/io.rs6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/libcore/io.rs b/src/libcore/io.rs
index e210ab0944c..937aa5976ef 100644
--- a/src/libcore/io.rs
+++ b/src/libcore/io.rs
@@ -331,7 +331,7 @@ impl <T: writer, C> of writer for {base: T, cleanup: C} {
 
 impl of writer for *libc::FILE {
     fn write(v: [const u8]/&) unsafe {
-        vec::unpack_slice(v) {|vbuf, len|
+        vec::unpack_const_slice(v) {|vbuf, len|
             let nout = libc::fwrite(vbuf as *c_void, len, 1u, self);
             if nout < 1 as size_t {
                 #error("error writing buffer");
@@ -359,9 +359,9 @@ fn FILE_writer(f: *libc::FILE, cleanup: bool) -> writer {
 impl of writer for fd_t {
     fn write(v: [const u8]/&) unsafe {
         let mut count = 0u;
-        vec::unpack_slice(v) {|vbuf, len|
+        vec::unpack_const_slice(v) {|vbuf, len|
             while count < len {
-                let vb = ptr::offset(vbuf, count) as *c_void;
+                let vb = ptr::const_offset(vbuf, count) as *c_void;
                 let nout = libc::write(self, vb, len);
                 if nout < 0 as ssize_t {
                     #error("error writing buffer");