liblibc and libnative: send() should use const buffers.

This commit is contained in:
NODA, Kai
2014-09-22 09:29:39 +08:00
parent 24bd8124ea
commit d4b7bdae33
3 changed files with 4 additions and 4 deletions
+2 -2
View 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,
+1 -1
View 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
};
+1 -1
View 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
};