summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-02-07 22:29:31 -0800
committerAlex Crichton <alex@alexcrichton.com>2015-02-07 22:29:31 -0800
commite12f9dfbdf79e334e983eb9c6b832c015837a8ce (patch)
treec68aad88c72f2c8c60b9a199fe9cb1ca77de1c48 /src
parentf13d77a3d240719c7a84faaea52e47ad3b49f561 (diff)
downloadssh2-rs-e12f9dfbdf79e334e983eb9c6b832c015837a8ce.zip
Update to rust master
Diffstat (limited to 'src')
-rw-r--r--src/agent.rs4
-rw-r--r--src/session.rs5
2 files changed, 4 insertions, 5 deletions
diff --git a/src/agent.rs b/src/agent.rs
index e6943f2..710cd98 100644
--- a/src/agent.rs
+++ b/src/agent.rs
@@ -100,8 +100,8 @@ impl<'agent> PublicKey<'agent> {
/// Return the data of this public key.
pub fn blob(&self) -> &[u8] {
unsafe {
- slice::from_raw_mut_buf(&(*self.raw).blob,
- (*self.raw).blob_len as usize)
+ slice::from_raw_parts_mut((*self.raw).blob,
+ (*self.raw).blob_len as usize)
}
}
diff --git a/src/session.rs b/src/session.rs
index c4ea9ec..66ad1ee 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -509,8 +509,7 @@ impl Session {
unsafe {
let ret = raw::libssh2_session_hostkey(self.raw, &mut len, &mut kind);
if ret.is_null() { return None }
- let ret = ret as *const u8;
- let data = mem::transmute(slice::from_raw_buf(&ret, len as usize));
+ let data = slice::from_raw_parts(ret as *const u8, len as usize);
let kind = match kind {
raw::LIBSSH2_HOSTKEY_TYPE_RSA => HostKeyType::Rsa,
raw::LIBSSH2_HOSTKEY_TYPE_DSS => HostKeyType::Dss,
@@ -535,7 +534,7 @@ impl Session {
None
} else {
let ret = ret as *const u8;
- Some(mem::transmute(slice::from_raw_buf(&ret, len)))
+ Some(slice::from_raw_parts(ret, len))
}
}
}