Commit 74bba7d5 authored by Steven Fackler's avatar Steven Fackler
Browse files

Merge pull request #140 from alexcrichton/update

Update to rust master
parents 8b67adfc 9dfeea6c
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
#![allow(unstable)]

extern crate "pkg-config" as pkg_config;

use std::os;
+6 −6
Original line number Diff line number Diff line
#![allow(non_camel_case_types, non_upper_case_globals, non_snake_case)]
#![allow(dead_code)]
#![allow(dead_code, unstable)]

extern crate libc;

@@ -197,12 +197,12 @@ static mut GUARDS: *mut Vec<Option<MutexGuard<'static, ()>>> = 0 as *mut Vec<Opt
extern fn locking_function(mode: c_int, n: c_int, _file: *const c_char,
                               _line: c_int) {
    unsafe {
        let mutex = &(*MUTEXES)[n as uint];
        let mutex = &(*MUTEXES)[n as usize];

        if mode & CRYPTO_LOCK != 0 {
            (*GUARDS)[n as uint] = Some(mutex.lock().unwrap());
            (*GUARDS)[n as usize] = Some(mutex.lock().unwrap());
        } else {
            &(*GUARDS)[n as uint].take();
            &(*GUARDS)[n as usize].take();
        }
    }
}
@@ -216,10 +216,10 @@ pub fn init() {
            SSL_load_error_strings();

            let num_locks = CRYPTO_num_locks();
            let mutexes = box range(0, num_locks).map(|_| MUTEX_INIT).collect::<Vec<_>>();
            let mutexes = Box::new(range(0, num_locks).map(|_| MUTEX_INIT).collect::<Vec<_>>());
            MUTEXES = mem::transmute(mutexes);
            let guards: Box<Vec<Option<MutexGuard<()>>>> =
                box range(0, num_locks).map(|_| None).collect();
                Box::new(range(0, num_locks).map(|_| None).collect());
            GUARDS = mem::transmute(guards);

            CRYPTO_set_locking_callback(locking_function);
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ impl Asn1Time {
    }

    /// Creates a new time on specified interval in days from now
    pub fn days_from_now(days: uint) -> Result<Asn1Time, SslError> {
    pub fn days_from_now(days: u32) -> Result<Asn1Time, SslError> {
        Asn1Time::new_with_period(days as u64 * 60 * 60 * 24)
    }

+3 −3
Original line number Diff line number Diff line
@@ -58,7 +58,7 @@ impl MemBio {
}

impl Reader for MemBio {
    fn read(&mut self, buf: &mut [u8]) -> IoResult<uint> {
    fn read(&mut self, buf: &mut [u8]) -> IoResult<usize> {
        let ret = unsafe {
            ffi::BIO_read(self.bio, buf.as_ptr() as *mut c_void,
                          buf.len() as c_int)
@@ -81,7 +81,7 @@ impl Reader for MemBio {
            };
            Err(err)
        } else {
            Ok(ret as uint)
            Ok(ret as usize)
        }
    }
}
@@ -92,7 +92,7 @@ impl Writer for MemBio {
            ffi::BIO_write(self.bio, buf.as_ptr() as *const c_void,
                           buf.len() as c_int)
        };
        if buf.len() != ret as uint {
        if buf.len() != ret as usize {
            Err(IoError {
                kind: OtherIoError,
                desc: "MemBio write error",
+1 −1
Original line number Diff line number Diff line
@@ -408,7 +408,7 @@ impl BigNum {
    }

    pub fn to_vec(&self) -> Vec<u8> {
        let size = self.num_bytes() as uint;
        let size = self.num_bytes() as usize;
        let mut v = Vec::with_capacity(size);
        unsafe {
            ffi::BN_bn2bin(self.raw(), v.as_mut_ptr());
Loading