about summary refs log tree commit diff
path: root/src/libstd
diff options
context:
space:
mode:
authorklutzy <klutzytheklutzy@gmail.com>2013-08-12 15:06:06 +0900
committerklutzy <klutzytheklutzy@gmail.com>2013-08-26 22:15:32 +0900
commit6aff4c67f607a38bc4d95e132fe40563e7422beb (patch)
treeab9556b66bd068fd39483905811a6ffe33d24f5f /src/libstd
parent37e99ae4cd510a92e3306d4938200124c2451c23 (diff)
downloadrust-6aff4c67f607a38bc4d95e132fe40563e7422beb.tar.gz
rust-6aff4c67f607a38bc4d95e132fe40563e7422beb.zip
std: Bind write() on Win64
Diffstat (limited to 'src/libstd')
-rw-r--r--src/libstd/io.rs20
1 files changed, 15 insertions, 5 deletions
diff --git a/src/libstd/io.rs b/src/libstd/io.rs
index 2412ce9daf3..e3f88033bd0 100644
--- a/src/libstd/io.rs
+++ b/src/libstd/io.rs
@@ -53,7 +53,7 @@ use container::Container;
 use int;
 use iterator::Iterator;
 use libc::consts::os::posix88::*;
-use libc::{c_int, c_long, c_void, size_t, ssize_t};
+use libc::{c_int, c_void, size_t};
 use libc;
 use num;
 use ops::Drop;
@@ -970,7 +970,7 @@ impl Reader for *libc::FILE {
 
         unsafe {
             assert!(libc::fseek(*self,
-                                     offset as c_long,
+                                     offset as libc::c_long,
                                      convert_whence(whence)) == 0 as c_int);
         }
     }
@@ -1199,7 +1199,7 @@ impl Writer for *libc::FILE {
 
         unsafe {
             assert!(libc::fseek(*self,
-                                     offset as c_long,
+                                     offset as libc::c_long,
                                      convert_whence(whence)) == 0 as c_int);
         }
     }
@@ -1240,13 +1240,23 @@ impl Writer for fd_t {
     fn write(&self, v: &[u8]) {
         #[fixed_stack_segment]; #[inline(never)];
 
+        #[cfg(windows)]
+        type IoSize = libc::c_uint;
+        #[cfg(windows)]
+        type IoRet = c_int;
+
+        #[cfg(unix)]
+        type IoSize = size_t;
+        #[cfg(unix)]
+        type IoRet = libc::ssize_t;
+
         unsafe {
             let mut count = 0u;
             do v.as_imm_buf |vbuf, len| {
                 while count < len {
                     let vb = ptr::offset(vbuf, count as int) as *c_void;
-                    let nout = libc::write(*self, vb, len as size_t);
-                    if nout < 0 as ssize_t {
+                    let nout = libc::write(*self, vb, len as IoSize);
+                    if nout < 0 as IoRet {
                         error!("error writing buffer");
                         error!("%s", os::last_os_error());
                         fail!();