Commit 3f413e93 authored by Valerii Hiora's avatar Valerii Hiora
Browse files

Addressed review comments

- fixed invalid file permissions

- removed redundand mem::transmute

- removed outdated FIXME's

- removed redundand temporary variable

- removed macro_export for internal macros
parent 4fd169a1
Loading
Loading
Loading
Loading
+3 −6
Original line number Diff line number Diff line
@@ -43,10 +43,9 @@ impl MemBio {
    /// Consumes current bio and returns wrapped value
    /// Note that data ownership is lost and
    /// should be handled manually
    pub unsafe fn unwrap(self) -> *mut ffi::BIO {
        let mut t = self;
        t.owned = false;
        t.bio
    pub unsafe fn unwrap(mut self) -> *mut ffi::BIO {
        self.owned = false;
        self.bio
    }

    /// Temporarily gets wrapped value
@@ -57,7 +56,6 @@ impl MemBio {

impl Reader for MemBio {
    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
        // FIXME: merge with read
        let ret = unsafe {
            ffi::BIO_read(self.bio, buf.as_ptr() as *mut c_void,
                          buf.len() as c_int)
@@ -74,7 +72,6 @@ impl Reader for MemBio {

impl Writer for MemBio {
    fn write(&mut self, buf: &[u8]) -> IoResult<()> {
        // FIXME: merge with write
        let ret = unsafe {
            ffi::BIO_write(self.bio, buf.as_ptr() as *const c_void,
                           buf.len() as c_int)

src/lib.rs

100755 → 100644
+0 −0

File mode changed from 100755 to 100644.

src/macros.rs

100755 → 100644
+0 −6
Original line number Diff line number Diff line
#![macro_escape]

#[macro_export]
macro_rules! try_ssl_stream {
    ($e:expr) => (
        match $e {
@@ -11,7 +10,6 @@ macro_rules! try_ssl_stream {
}

/// Shortcut return with SSL error if something went wrong
#[macro_export]
macro_rules! try_ssl_if {
    ($e:expr) => (
        if $e {
@@ -22,13 +20,11 @@ macro_rules! try_ssl_if {

/// Shortcut return with SSL error if last error result is 0
/// (default)
#[macro_export]
macro_rules! try_ssl{
    ($e:expr) => (try_ssl_if!($e == 0))
}

/// Shortcut return with SSL if got a null result
#[macro_export]
macro_rules! try_ssl_null{
    ($e:expr) => (try_ssl_if!($e == ptr::null_mut()))
}
@@ -42,7 +38,6 @@ macro_rules! try_ssl_null{
/// let _ = try!(something)
/// Ok(())
/// ```
#[macro_export]
macro_rules! lift_ssl_if{
    ($e:expr) => ( {
        if $e {
@@ -55,7 +50,6 @@ macro_rules! lift_ssl_if{

/// Lifts current SSL error code into Result<(), Error>
/// if SSL returned 0 (default error indication)
#[macro_export]
macro_rules! lift_ssl {
    ($e:expr) => (lift_ssl_if!($e == 0))
}
+2 −2
Original line number Diff line number Diff line
@@ -184,8 +184,8 @@ impl X509Generator {
    fn add_extension(x509: *mut ffi::X509, extension: c_int, value: &str) -> Result<(), SslError> {
        unsafe {
            // FIXME: RAII
            let ctx: ffi::X509V3_CTX = mem::zeroed();
            ffi::X509V3_set_ctx(mem::transmute(&ctx), x509, x509,
            let mut ctx: ffi::X509V3_CTX = mem::zeroed();
            ffi::X509V3_set_ctx(&mut ctx, x509, x509,
                                ptr::null_mut(), ptr::null_mut(), 0);
            let ext = value.with_c_str(|value|
                                       ffi::X509V3_EXT_conf_nid(ptr::null_mut(), mem::transmute(&ctx), extension, mem::transmute(value)));