diff options
author | mredlek <mredlek@users.noreply.github.com> | 2017-01-27 19:11:05 +0100 |
---|---|---|
committer | mredlek <mredlek@users.noreply.github.com> | 2017-01-27 19:13:36 +0100 |
commit | 6a8f6f425f504459a6f4c54eac273f543c53a55e (patch) | |
tree | 3cffaa2dba25a42d375ba7cbcba40087d5dc0f5f /openssl | |
parent | 557b936e27177718b62d31dcf3364f481bb15c2c (diff) | |
download | rust-openssl-6a8f6f425f504459a6f4c54eac273f543c53a55e.zip |
Style changes according to review
Diffstat (limited to 'openssl')
-rw-r--r-- | openssl/src/asn1.rs | 11 | ||||
-rw-r--r-- | openssl/src/x509/mod.rs | 5 |
2 files changed, 5 insertions, 11 deletions
diff --git a/openssl/src/asn1.rs b/openssl/src/asn1.rs index f5d6a102..dc616b59 100644 --- a/openssl/src/asn1.rs +++ b/openssl/src/asn1.rs @@ -80,19 +80,14 @@ type_!(Asn1Integer, Asn1IntegerRef, ffi::ASN1_INTEGER, ffi::ASN1_INTEGER_free); impl Asn1IntegerRef { pub fn get(&self) -> i64 { unsafe { - return ::ffi::ASN1_INTEGER_get(self.as_ptr()); + ::ffi::ASN1_INTEGER_get(self.as_ptr()) as i64 } } - pub fn set(&self, value: i64) -> Result<(), ErrorStack> + pub fn set(&mut self, value: i32) -> Result<(), ErrorStack> { unsafe { - let res = ::ffi::ASN1_INTEGER_set(self.as_ptr(), value); - if res < 0 { - return Err(ErrorStack::get()); - } - - Ok(()) + cvt(::ffi::ASN1_INTEGER_set(self.as_ptr(), value as c_long)).map(|_| ()) } } } diff --git a/openssl/src/x509/mod.rs b/openssl/src/x509/mod.rs index 2edfa675..23d9bcaa 100644 --- a/openssl/src/x509/mod.rs +++ b/openssl/src/x509/mod.rs @@ -600,11 +600,10 @@ impl X509ReqRef { to_pem!(ffi::PEM_write_bio_X509_REQ); to_der!(ffi::i2d_X509_REQ); - pub fn version(&self) -> i64 + pub fn version(&self) -> i32 { unsafe { - let version = compat::X509_REQ_get_version(self.as_ptr()); - version + compat::X509_REQ_get_version(self.as_ptr()) as i32 } } |