]> git.lizzy.rs Git - rust.git/commitdiff
liblibc and libnative: send() should use const buffers.
authorNODA, Kai <nodakai@gmail.com>
Mon, 22 Sep 2014 01:29:39 +0000 (09:29 +0800)
committerNODA, Kai <nodakai@gmail.com>
Wed, 24 Sep 2014 02:36:40 +0000 (10:36 +0800)
src/liblibc/lib.rs
src/libnative/io/net.rs
src/libnative/io/pipe_unix.rs

index 35b05a672b28dc8720e3e7d40e998665812d75c2..494c98bc54da281df254799dbb43bcb3135e2959 100644 (file)
@@ -4633,7 +4633,7 @@ pub fn setsockopt(socket: c_int, level: c_int, name: c_int,
                               option_len: socklen_t) -> c_int;
             pub fn recv(socket: c_int, buf: *mut c_void, len: size_t,
                         flags: c_int) -> ssize_t;
-            pub fn send(socket: c_int, buf: *mut c_void, len: size_t,
+            pub fn send(socket: c_int, buf: *const c_void, len: size_t,
                         flags: c_int) -> ssize_t;
             pub fn recvfrom(socket: c_int, buf: *mut c_void, len: size_t,
                             flags: c_int, addr: *mut sockaddr,
@@ -4673,7 +4673,7 @@ pub fn setsockopt(socket: SOCKET, level: c_int, name: c_int,
             pub fn closesocket(socket: SOCKET) -> c_int;
             pub fn recv(socket: SOCKET, buf: *mut c_void, len: c_int,
                         flags: c_int) -> c_int;
-            pub fn send(socket: SOCKET, buf: *mut c_void, len: c_int,
+            pub fn send(socket: SOCKET, buf: *const c_void, len: c_int,
                         flags: c_int) -> c_int;
             pub fn recvfrom(socket: SOCKET, buf: *mut c_void, len: c_int,
                             flags: c_int, addr: *mut sockaddr,
index 8418e741167e8bac5391cee7188ae2c51b991a72..335a52b0bbed6ce63ed5f030b79ffeb52ef40a90 100644 (file)
@@ -337,7 +337,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
-                       buf as *mut libc::c_void,
+                       buf as *const _,
                        len as wrlen,
                        flags) as i64
         };
index c222907fa5b88afc62eb1d443a698d35c074cd9c..48f31615339a0ef7d58cb0b71a47850d66009afe 100644 (file)
@@ -173,7 +173,7 @@ fn write(&mut self, buf: &[u8]) -> IoResult<()> {
         let dowrite = |nb: bool, buf: *const u8, len: uint| unsafe {
             let flags = if nb {c::MSG_DONTWAIT} else {0};
             libc::send(fd,
-                       buf as *mut libc::c_void,
+                       buf as *const _,
                        len as libc::size_t,
                        flags) as i64
         };