aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValerii Hiora <[email protected]>2014-09-28 07:09:57 +0300
committerValerii Hiora <[email protected]>2014-09-28 07:18:45 +0300
commit3f413e9354238919bce6dc87e3415919f301d487 (patch)
treec0b446d704cc6f220e7535ec49d6ec37406ea83e /src
parentCertificate/pkey generation & PEM export (diff)
downloadrust-openssl-3f413e9354238919bce6dc87e3415919f301d487.tar.xz
rust-openssl-3f413e9354238919bce6dc87e3415919f301d487.zip
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
Diffstat (limited to 'src')
-rw-r--r--src/bio/mod.rs9
-rw-r--r--[-rwxr-xr-x]src/lib.rs0
-rw-r--r--[-rwxr-xr-x]src/macros.rs6
-rwxr-xr-xsrc/x509/mod.rs4
4 files changed, 5 insertions, 14 deletions
diff --git a/src/bio/mod.rs b/src/bio/mod.rs
index 019129ea..f81114de 100644
--- a/src/bio/mod.rs
+++ b/src/bio/mod.rs
@@ -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)
diff --git a/src/lib.rs b/src/lib.rs
index d142f865..d142f865 100755..100644
--- a/src/lib.rs
+++ b/src/lib.rs
diff --git a/src/macros.rs b/src/macros.rs
index b11f9dad..061381f2 100755..100644
--- a/src/macros.rs
+++ b/src/macros.rs
@@ -1,6 +1,5 @@
#![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))
}
diff --git a/src/x509/mod.rs b/src/x509/mod.rs
index 06ae4b27..cc911afe 100755
--- a/src/x509/mod.rs
+++ b/src/x509/mod.rs
@@ -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)));