diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/channel.rs | 6 | ||||
-rw-r--r-- | src/lib.rs | 2 |
2 files changed, 5 insertions, 3 deletions
diff --git a/src/channel.rs b/src/channel.rs index 88a9fdb..5135c22 100644 --- a/src/channel.rs +++ b/src/channel.rs @@ -1,6 +1,7 @@ +use std::cmp; use std::io::prelude::*; use std::io::{self, ErrorKind}; -use std::cmp; +use std::slice; use libc::{c_uint, c_int, size_t, c_char, c_void, c_uchar}; use {raw, Session, Error}; @@ -230,7 +231,8 @@ impl<'sess> Channel<'sess> { unsafe fn convert(chan: &Channel, ptr: *mut c_char, len: size_t) -> Option<String> { if ptr.is_null() { return None } - let ret = Vec::from_raw_buf(ptr as *const u8, len as usize); + let slice = slice::from_raw_parts(ptr as *const u8, len as usize); + let ret = slice.to_vec(); raw::libssh2_free(chan.sess.raw(), ptr as *mut c_void); String::from_utf8(ret).ok() } @@ -124,7 +124,7 @@ //! ``` #![doc(html_root_url = "http://alexcrichton.com/ssh2-rs")] -#![feature(unsafe_destructor, collections, io, io_ext, convert)] +#![feature(unsafe_destructor, io, io_ext, convert)] #![allow(trivial_numeric_casts)] #![deny(missing_docs, unused_results)] #![cfg_attr(test, deny(warnings))] |