Skip to content

Commit

Permalink
liblibc and libnative: send() should use const buffers.
Browse files Browse the repository at this point in the history
  • Loading branch information
nodakai committed Sep 24, 2014
1 parent 24bd812 commit d4b7bda
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/liblibc/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4633,7 +4633,7 @@ pub mod funcs {
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,
Expand Down Expand Up @@ -4673,7 +4673,7 @@ pub mod funcs {
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,
Expand Down
2 changes: 1 addition & 1 deletion src/libnative/io/net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -337,7 +337,7 @@ impl rtio::RtioTcpStream for TcpStream {
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
};
Expand Down
2 changes: 1 addition & 1 deletion src/libnative/io/pipe_unix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,7 @@ impl rtio::RtioPipe for UnixStream {
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
};
Expand Down

5 comments on commit d4b7bda

@bors
Copy link
Contributor

@bors bors commented on d4b7bda Sep 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

saw approval from alexcrichton
at nodakai@d4b7bda

@bors
Copy link
Contributor

@bors bors commented on d4b7bda Sep 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

merging nodakai/rust/libnative-misc-fixes = d4b7bda into auto

@bors
Copy link
Contributor

@bors bors commented on d4b7bda Sep 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nodakai/rust/libnative-misc-fixes = d4b7bda merged ok, testing candidate = 375fe17

@bors
Copy link
Contributor

@bors bors commented on d4b7bda Sep 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bors
Copy link
Contributor

@bors bors commented on d4b7bda Sep 25, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fast-forwarding master to auto = 375fe17

Please sign in to comment.