summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAlex Crichton <alex@alexcrichton.com>2015-10-07 10:21:47 -0700
committerAlex Crichton <alex@alexcrichton.com>2015-10-07 10:21:47 -0700
commit251ec8bdd0f8010ffb1f82853652d6566e1e6a13 (patch)
treeda235d261e73fe3c42698bfe4a38e50db148227e /src
parentd5b69eb0db8f1054246c273a3d49c6209dc90366 (diff)
downloadssh2-rs-251ec8bdd0f8010ffb1f82853652d6566e1e6a13.zip
Add automated testing of FFI bindings
Diffstat (limited to 'src')
-rw-r--r--src/channel.rs14
-rw-r--r--src/session.rs12
2 files changed, 13 insertions, 13 deletions
diff --git a/src/channel.rs b/src/channel.rs
index 40933a1..cb4cf0f 100644
--- a/src/channel.rs
+++ b/src/channel.rs
@@ -2,7 +2,7 @@ use std::cmp;
use std::io::prelude::*;
use std::io::{self, ErrorKind};
use std::slice;
-use libc::{c_uint, c_int, size_t, c_char, c_void, c_uchar};
+use libc::{c_uint, c_int, size_t, c_char, c_void, c_uchar, c_ulong};
use {raw, Session, Error};
use util::{Binding, SessionBinding};
@@ -274,17 +274,17 @@ impl<'sess> Channel<'sess> {
///
/// This function returns the new size of the receive window (as understood
/// by remote end) on success.
- pub fn adjust_receive_window(&mut self, adjust: u32, force: bool)
- -> Result<u32, Error> {
+ pub fn adjust_receive_window(&mut self, adjust: u64, force: bool)
+ -> Result<u64, Error> {
let mut ret = 0;
let rc = unsafe {
raw::libssh2_channel_receive_window_adjust2(self.raw,
- adjust as c_uint,
+ adjust as c_ulong,
force as c_uchar,
&mut ret)
};
try!(self.sess.rc(rc));
- Ok(ret as u32)
+ Ok(ret as u64)
}
/// Artificially limit the number of bytes that will be read from this
@@ -390,7 +390,7 @@ impl<'channel, 'sess> Read for Stream<'channel, 'sess> {
self.id as c_int,
data.as_mut_ptr() as *mut _,
data.len() as size_t);
- self.channel.sess.rc(rc).map(|()| rc as usize)
+ self.channel.sess.rc(rc as c_int).map(|()| rc as usize)
};
match ret {
Ok(n) => {
@@ -411,7 +411,7 @@ impl<'channel, 'sess> Write for Stream<'channel, 'sess> {
self.id as c_int,
data.as_ptr() as *mut _,
data.len() as size_t);
- self.channel.sess.rc(rc).map(|()| rc as usize)
+ self.channel.sess.rc(rc as c_int).map(|()| rc as usize)
}.map_err(|e| {
io::Error::new(ErrorKind::Other, e)
})
diff --git a/src/session.rs b/src/session.rs
index 30ac664..1a23f5b 100644
--- a/src/session.rs
+++ b/src/session.rs
@@ -37,7 +37,8 @@ impl Session {
pub fn new() -> Option<Session> {
::init();
unsafe {
- let ret = raw::libssh2_session_init_ex(None, None, None);
+ let ret = raw::libssh2_session_init_ex(None, None, None,
+ 0 as *mut _);
if ret.is_null() {None} else {Some(Binding::from_raw(ret))}
}
}
@@ -455,7 +456,7 @@ impl Session {
let ret = raw::libssh2_scp_send64(self.raw,
path.as_ptr(),
mode as c_int,
- size,
+ size as i64,
mtime as libc::time_t,
atime as libc::time_t);
SessionBinding::from_raw_opt(self, ret)
@@ -562,11 +563,10 @@ impl Session {
/// The interval argument is number of seconds that can pass without any
/// I/O, use 0 (the default) to disable keepalives. To avoid some busy-loop
/// corner-cases, if you specify an interval of 1 it will be treated as 2.
- pub fn set_keepalive(&self, want_reply: bool, interval: u32)
- -> Result<(), Error> {
+ pub fn set_keepalive(&self, want_reply: bool, interval: u32) {
unsafe {
- self.rc(raw::libssh2_keepalive_config(self.raw, want_reply as c_int,
- interval as c_uint))
+ raw::libssh2_keepalive_config(self.raw, want_reply as c_int,
+ interval as c_uint)
}
}