Skip to content

Commit bbc4339

Browse files
author
pierresy
committed
Fixes for rust 1.4
1 parent b8989b2 commit bbc4339

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22

33
name = "rust-sctp"
4-
version = "0.0.2"
4+
version = "0.0.3"
55
description = "High level SCTP networking library"
66
repository = "https://github.com/phsym/rust-sctp"
77
documentation = "http://phsym.github.io/rust-sctp"

src/sctpsock.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ impl SctpAddrType {
8989

9090

9191
/// Manage low level socket address structure
92-
pub trait RawSocketAddr {
92+
pub trait RawSocketAddr: Sized {
9393
/// Get the address family for this socket address
9494
fn family(&self) -> i32;
9595

@@ -131,7 +131,7 @@ impl RawSocketAddr for SocketAddr {
131131
return match (*addr).sa_family as libc::c_int {
132132
libc::AF_INET if len >= size_of::<libc::sockaddr_in>() as libc::socklen_t => Ok(SocketAddr::V4(transmute(*(addr as *const libc::sockaddr_in)))),
133133
libc::AF_INET6 if len >= size_of::<libc::sockaddr_in6>() as libc::socklen_t => Ok(SocketAddr::V6(transmute(*(addr as *const libc::sockaddr_in6)))),
134-
_ => Err(Error::new(ErrorKind::InvalidInput, "Cannot get peer socket address"))
134+
_ => Err(Error::new(ErrorKind::InvalidInput, "Invalid socket address"))
135135
};
136136
}
137137

@@ -182,7 +182,7 @@ impl SctpSocket {
182182
pub fn connectx<A: ToSocketAddrs>(&self, addresses: &[A]) -> Result<sctp_sys::sctp_assoc_t> {
183183
if addresses.len() == 0 { return Err(Error::new(ErrorKind::InvalidInput, "No addresses given")); }
184184
unsafe {
185-
let buf: *mut u8 = libc::malloc((addresses.len() * size_of::<libc::sockaddr_in6>()) as u64) as *mut u8;
185+
let buf: *mut u8 = libc::malloc((addresses.len() * size_of::<libc::sockaddr_in6>()) as libc::size_t) as *mut u8;
186186
if buf.is_null() {
187187
return Err(Error::new(ErrorKind::Other, "Out of memory"));
188188
}
@@ -219,7 +219,7 @@ impl SctpSocket {
219219
pub fn bindx<A: ToSocketAddrs>(&self, addresses: &[A], op: BindOp) -> Result<()> {
220220
if addresses.len() == 0 { return Err(Error::new(ErrorKind::InvalidInput, "No addresses given")); }
221221
unsafe {
222-
let buf: *mut u8 = libc::malloc((addresses.len() * size_of::<libc::sockaddr_in6>()) as u64) as *mut u8;
222+
let buf: *mut u8 = libc::malloc((addresses.len() * size_of::<libc::sockaddr_in6>()) as libc::size_t) as *mut u8;
223223
if buf.is_null() {
224224
return Err(Error::new(ErrorKind::Other, "Out of memory"));
225225
}
@@ -266,7 +266,7 @@ impl SctpSocket {
266266
unsafe {
267267
let mut addrs: *mut u8 = std::ptr::null_mut();
268268
let len = what.get(self.0, id, transmute(&mut addrs));
269-
if len < 0 { return Err(Error::new(ErrorKind::Other, "Cannot retrieve local addresses")); }
269+
if len < 0 { return Err(Error::new(ErrorKind::Other, "Cannot retrieve addresses")); }
270270
if len == 0 { return Err(Error::new(ErrorKind::AddrNotAvailable, "Socket is unbound")); }
271271

272272
let mut vec = Vec::with_capacity(len as usize);

0 commit comments

Comments
 (0)