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/src/asn1.rs | |
parent | 557b936e27177718b62d31dcf3364f481bb15c2c (diff) | |
download | rust-openssl-6a8f6f425f504459a6f4c54eac273f543c53a55e.zip |
Style changes according to review
Diffstat (limited to 'openssl/src/asn1.rs')
-rw-r--r-- | openssl/src/asn1.rs | 11 |
1 files changed, 3 insertions, 8 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(|_| ()) } } } |