diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-01-29 14:50:39 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-01-29 17:41:26 +0100 |
commit | 442740975e41208c1cad300bc023ddedb04fc3a6 (patch) | |
tree | 01ef5d601e9aaed94c8700620ee2ee70bf91193b /openpgp-ffi/src | |
parent | 51790b4fa46b41eba4c98b14a1193ad8e55b19b3 (diff) |
openpgp-ffi: Explicitly convert to failure::Error.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/armor.rs | 6 | ||||
-rw-r--r-- | openpgp-ffi/src/common.rs | 4 | ||||
-rw-r--r-- | openpgp-ffi/src/io.rs | 8 | ||||
-rw-r--r-- | openpgp-ffi/src/serialize.rs | 4 |
4 files changed, 11 insertions, 11 deletions
diff --git a/openpgp-ffi/src/armor.rs b/openpgp-ffi/src/armor.rs index 80b7f62a..41a78854 100644 --- a/openpgp-ffi/src/armor.rs +++ b/openpgp-ffi/src/armor.rs @@ -121,7 +121,7 @@ pub extern "system" fn pgp_armor_reader_from_file(errp: Option<&mut *mut failure ffi_try_box!(armor::Reader::from_file(&filename, kind) .map(|r| Box::new(r)) - .map_err(|e| e.into())) + .map_err(|e| ::failure::Error::from(e))) } /// Creates a `Reader` from a buffer. @@ -248,7 +248,7 @@ pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut failure:: // We need to be extra careful here in order not to keep ownership // of `reader` in case of errors. - let result = match reader.headers().map_err(|e| e.into()) { + let result = match reader.headers().map_err(|e| ::failure::Error::from(e)) { Ok(headers) => { // Allocate space for the result. let buf = unsafe { @@ -384,5 +384,5 @@ pub extern "system" fn pgp_armor_writer_new ffi_try_box!(armor::Writer::new(inner, kind, &header) .map(|r| Box::new(r)) - .map_err(|e| e.into())) + .map_err(|e| ::failure::Error::from(e))) } diff --git a/openpgp-ffi/src/common.rs b/openpgp-ffi/src/common.rs index 0ad74ed9..bb21276f 100644 --- a/openpgp-ffi/src/common.rs +++ b/openpgp-ffi/src/common.rs @@ -607,7 +607,7 @@ fn verify_real<'a>(input: &'a mut Box<'a + Read>, failure::Error::from_boxed_compat(e.into_inner().unwrap()) } else { // Plain io::Error. - e.into() + ::failure::Error::from(e) }).context("Verification failed")?; Ok(()) @@ -725,7 +725,7 @@ fn decrypt_real<'a>(input: &'a mut Box<'a + Read>, failure::Error::from_boxed_compat(e.into_inner().unwrap()) } else { // Plain io::Error. - e.into() + ::failure::Error::from(e) }).context("Decryption failed")?; Ok(()) diff --git a/openpgp-ffi/src/io.rs b/openpgp-ffi/src/io.rs index 32309792..ca32ffca 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -19,7 +19,7 @@ pub extern "system" fn pgp_reader_from_file(errp: Option<&mut *mut failure::Erro let filename = ffi_param_cstr!(filename).to_string_lossy().into_owned(); ffi_try_box!(File::open(Path::new(&filename)) .map(|r| Box::new(r)) - .map_err(|e| e.into())) + .map_err(|e| ::failure::Error::from(e))) } /// Opens a file descriptor returning a reader. @@ -60,7 +60,7 @@ pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut failure::Error>, let buf = unsafe { slice::from_raw_parts_mut(buf, len as usize) }; - ffi_try_or!(reader.read(buf).map_err(|e| e.into()), -1) as ssize_t + ffi_try_or!(reader.read(buf).map_err(|e| ::failure::Error::from(e)), -1) as ssize_t } @@ -76,7 +76,7 @@ pub extern "system" fn pgp_writer_from_file(errp: Option<&mut *mut failure::Erro let filename = ffi_param_cstr!(filename).to_string_lossy().into_owned(); ffi_try_box!(File::create(Path::new(&filename)) .map(|r| Box::new(r)) - .map_err(|e| e.into())) + .map_err(|e| ::failure::Error::from(e))) } /// Opens a file descriptor returning a writer. @@ -171,5 +171,5 @@ pub extern "system" fn pgp_writer_write(errp: Option<&mut *mut failure::Error>, let buf = unsafe { slice::from_raw_parts(buf, len as usize) }; - ffi_try_or!(writer.write(buf).map_err(|e| e.into()), -1) as ssize_t + ffi_try_or!(writer.write(buf).map_err(|e| ::failure::Error::from(e)), -1) as ssize_t } diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs index f489ceb7..f94cb2ad 100644 --- a/openpgp-ffi/src/serialize.rs +++ b/openpgp-ffi/src/serialize.rs @@ -61,7 +61,7 @@ pub extern "system" fn pgp_writer_stack_write let buf = unsafe { slice::from_raw_parts(buf, len as usize) }; - ffi_try_or!(writer.write(buf).map_err(|e| e.into()), -1) as ssize_t + ffi_try_or!(writer.write(buf).map_err(|e| ::failure::Error::from(e)), -1) as ssize_t } /// Writes up to `len` bytes of `buf` into `writer`. @@ -82,7 +82,7 @@ pub extern "system" fn pgp_writer_stack_write_all let buf = unsafe { slice::from_raw_parts(buf, len as usize) }; - ffi_try_status!(writer.write_all(buf).map_err(|e| e.into())) + ffi_try_status!(writer.write_all(buf).map_err(|e| ::failure::Error::from(e))) } /// Finalizes this writer, returning the underlying writer. |