diff options
| author | Kevin Butler <[email protected]> | 2015-02-20 21:04:01 +0000 |
|---|---|---|
| committer | Kevin Butler <[email protected]> | 2015-02-20 21:04:01 +0000 |
| commit | cb0e1688c8aa2e07a917851c829b24e4528d1282 (patch) | |
| tree | 6a9951abe98a6d8eabfbd1a5723ba561014e7491 /openssl/src/bn | |
| parent | Unique<T> now derefs to *mut T (diff) | |
| download | rust-openssl-cb0e1688c8aa2e07a917851c829b24e4528d1282.tar.xz rust-openssl-cb0e1688c8aa2e07a917851c829b24e4528d1282.zip | |
Update depreciated code
Diffstat (limited to 'openssl/src/bn')
| -rw-r--r-- | openssl/src/bn/mod.rs | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/openssl/src/bn/mod.rs b/openssl/src/bn/mod.rs index 3a5f231e..4b93690f 100644 --- a/openssl/src/bn/mod.rs +++ b/openssl/src/bn/mod.rs @@ -1,5 +1,5 @@ use libc::{c_int, c_ulong, c_void}; -use std::ffi::{CString, c_str_to_bytes}; +use std::ffi::{CStr, CString}; use std::cmp::Ordering; use std::{fmt, ptr}; @@ -88,7 +88,7 @@ impl BigNum { pub fn from_dec_str(s: &str) -> Result<BigNum, SslError> { BigNum::new().and_then(|v| unsafe { - let c_str = CString::from_slice(s.as_bytes()); + let c_str = CString::new(s.as_bytes()).unwrap(); try_ssl!(ffi::BN_dec2bn(v.raw_ptr(), c_str.as_ptr())); Ok(v) }) @@ -96,7 +96,7 @@ impl BigNum { pub fn from_hex_str(s: &str) -> Result<BigNum, SslError> { BigNum::new().and_then(|v| unsafe { - let c_str = CString::from_slice(s.as_bytes()); + let c_str = CString::new(s.as_bytes()).unwrap(); try_ssl!(ffi::BN_hex2bn(v.raw_ptr(), c_str.as_ptr())); Ok(v) }) @@ -421,7 +421,7 @@ impl BigNum { unsafe { let buf = ffi::BN_bn2dec(self.raw()); assert!(!buf.is_null()); - let str = String::from_utf8(c_str_to_bytes(&buf).to_vec()).unwrap(); + let str = String::from_utf8(CStr::from_ptr(buf).to_bytes().to_vec()).unwrap(); ffi::CRYPTO_free(buf as *mut c_void); str } @@ -431,7 +431,7 @@ impl BigNum { unsafe { let buf = ffi::BN_bn2hex(self.raw()); assert!(!buf.is_null()); - let str = String::from_utf8(c_str_to_bytes(&buf).to_vec()).unwrap(); + let str = String::from_utf8(CStr::from_ptr(buf).to_bytes().to_vec()).unwrap(); ffi::CRYPTO_free(buf as *mut c_void); str } |