diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2019-01-29 14:16:30 +0100 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2019-01-29 17:41:26 +0100 |
commit | e5f3ae121f39b46cbc0416acb4ba7049f40203d2 (patch) | |
tree | 96b9c4881271006f76e8e3f6ff90cfe2335e8d20 /openpgp-ffi | |
parent | 442740975e41208c1cad300bc023ddedb04fc3a6 (diff) |
openpgp-ffi: Convert Error.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r-- | openpgp-ffi/src/armor.rs | 10 | ||||
-rw-r--r-- | openpgp-ffi/src/common.rs | 12 | ||||
-rw-r--r-- | openpgp-ffi/src/crypto.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/error.rs | 24 | ||||
-rw-r--r-- | openpgp-ffi/src/io.rs | 9 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/key.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/pkesk.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/packet/skesk.rs | 2 | ||||
-rw-r--r-- | openpgp-ffi/src/packet_pile.rs | 8 | ||||
-rw-r--r-- | openpgp-ffi/src/parse.rs | 19 | ||||
-rw-r--r-- | openpgp-ffi/src/serialize.rs | 18 | ||||
-rw-r--r-- | openpgp-ffi/src/tpk.rs | 24 | ||||
-rw-r--r-- | openpgp-ffi/src/tsk.rs | 4 |
13 files changed, 70 insertions, 66 deletions
diff --git a/openpgp-ffi/src/armor.rs b/openpgp-ffi/src/armor.rs index 41a78854..f1563c32 100644 --- a/openpgp-ffi/src/armor.rs +++ b/openpgp-ffi/src/armor.rs @@ -13,6 +13,8 @@ use libc::{self, uint8_t, c_char, c_int, size_t}; extern crate sequoia_openpgp; use self::sequoia_openpgp::armor; +use MoveIntoRaw; + /// Represents a (key, value) pair in an armor header. #[repr(C)] pub struct ArmorHeader { @@ -111,7 +113,7 @@ pub extern "system" fn pgp_armor_reader_new(inner: *mut Box<Read>, /// Creates a `Reader` from a file. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_armor_reader_from_file(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_armor_reader_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char, kind: c_int) -> *mut Box<Read> { @@ -233,7 +235,7 @@ pub extern "system" fn pgp_armor_reader_kind(reader: *mut Box<Read>) /// /// [this]: fn.pgp_armor_reader_new.html #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut ::error::Error>, reader: *mut Box<Read>, len: *mut size_t) -> *mut ArmorHeader { @@ -268,7 +270,7 @@ pub extern "system" fn pgp_armor_reader_headers(errp: Option<&mut *mut failure:: }, Err(e) => { if let Some(errp) = errp { - *errp = box_raw!(e); + *errp = e.move_into_raw(); } ptr::null_mut() }, @@ -354,7 +356,7 @@ fn strdup(s: &str) -> *mut c_char { /// ``` #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_armor_writer_new - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, inner: *mut Box<Write>, kind: c_int, header: *const ArmorHeader, diff --git a/openpgp-ffi/src/common.rs b/openpgp-ffi/src/common.rs index bb21276f..9d430a69 100644 --- a/openpgp-ffi/src/common.rs +++ b/openpgp-ffi/src/common.rs @@ -149,9 +149,10 @@ macro_rules! ffi_make_fry_from_errp { match $expr { Ok(_) => ::error::Status::Success, Err(e) => { + use MoveIntoRaw; let status = ::error::Status::from(&e); if let Some(errp) = $errp { - *errp = box_raw!(e); + *errp = e.move_into_raw(); } status }, @@ -169,8 +170,9 @@ macro_rules! ffi_make_fry_from_errp { match $expr { Ok(v) => v, Err(e) => { + use MoveIntoRaw; if let Some(errp) = $errp { - *errp = box_raw!(e); + *errp = e.move_into_raw(); } return $or; }, @@ -254,7 +256,7 @@ pub(crate) trait MoveIntoRaw<T> { /// Moves an object from Rust to C, releasing ownership. pub(crate) trait MoveResultIntoRaw<T> { /// Moves this object from Rust to C, releasing ownership. - fn move_into_raw(self, errp: Option<&mut *mut ::failure::Error>) -> T; + fn move_into_raw(self, errp: Option<&mut *mut self::error::Error>) -> T; } /// Indicates that a pointer may be NULL. @@ -621,7 +623,7 @@ fn verify_real<'a>(input: &'a mut Box<'a + Read>, /// /// Note: output may be NULL, if the output is not required. #[::ffi_catch_abort] #[no_mangle] -pub fn pgp_verify<'a>(errp: Option<&mut *mut failure::Error>, +pub fn pgp_verify<'a>(errp: Option<&mut *mut ::error::Error>, input: *mut Box<'a + Read>, dsig: Option<&'a mut Box<'a + Read>>, output: Option<&'a mut Box<'a + Write>>, @@ -744,7 +746,7 @@ fn decrypt_real<'a>(input: &'a mut Box<'a + Read>, /// /// Note: all of the parameters are required; none may be NULL. #[::ffi_catch_abort] #[no_mangle] -pub fn pgp_decrypt<'a>(errp: Option<&mut *mut failure::Error>, +pub fn pgp_decrypt<'a>(errp: Option<&mut *mut ::error::Error>, input: *mut Box<'a + Read>, output: *mut Box<'a + Write>, get_public_keys: GetPublicKeysCallback, diff --git a/openpgp-ffi/src/crypto.rs b/openpgp-ffi/src/crypto.rs index c1a65ace..eebd7f3a 100644 --- a/openpgp-ffi/src/crypto.rs +++ b/openpgp-ffi/src/crypto.rs @@ -21,7 +21,7 @@ pub extern "system" fn pgp_signer_free /// Creates a new key pair. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_key_pair_new - (errp: Option<&mut *mut failure::Error>, public: *mut Key, secret: *mut crypto::mpis::SecretKey) + (errp: Option<&mut *mut ::error::Error>, public: *mut Key, secret: *mut crypto::mpis::SecretKey) -> *mut crypto::KeyPair { ffi_make_fry_from_errp!(errp); diff --git a/openpgp-ffi/src/error.rs b/openpgp-ffi/src/error.rs index f3df776c..3d4dd3ca 100644 --- a/openpgp-ffi/src/error.rs +++ b/openpgp-ffi/src/error.rs @@ -6,28 +6,28 @@ use libc::c_char; extern crate sequoia_openpgp as openpgp; -/// Frees an error. -#[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_error_free(error: Option<&mut failure::Error>) { - ffi_free!(error) -} +/// Complex errors. +/// +/// This wraps [`failure::Error`]s. +/// +/// [`failure::Error`]: https://docs.rs/failure/0.1.5/failure/struct.Error.html +#[::ffi_wrapper_type(prefix = "pgp_", derive = "Display")] +pub struct Error(failure::Error); /// Returns the error message. /// /// The returned value must be freed with `free(3)`. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_error_string(error: *const failure::Error) - -> *mut c_char { - let error = ffi_param_ref!(error); - ffi_return_string!(&format!("{}", error)) +pub extern "system" fn pgp_error_string(error: *const Error) + -> *mut c_char { + ffi_return_string!(&format!("{}", error.ref_raw())) } /// Returns the error status code. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_error_status(error: *const failure::Error) +pub extern "system" fn pgp_error_status(error: *const Error) -> Status { - let error = ffi_param_ref!(error); - error.into() + error.ref_raw().into() } /// XXX: Reorder and name-space before release. diff --git a/openpgp-ffi/src/io.rs b/openpgp-ffi/src/io.rs index ca32ffca..436b6619 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -1,6 +1,5 @@ //! IO primitives for Sequoia. -use failure; use std::fs::File; use std::io::{self, Read, Write, Cursor}; use std::path::Path; @@ -12,7 +11,7 @@ use std::os::unix::io::FromRawFd; /// Opens a file returning a reader. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_reader_from_file(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_reader_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> *mut Box<Read> { ffi_make_fry_from_errp!(errp); @@ -50,7 +49,7 @@ pub extern "system" fn pgp_reader_free(reader: Option<&mut Box<Read>>) { /// Reads up to `len` bytes into `buf`. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut ::error::Error>, reader: *mut Box<Read>, buf: *mut uint8_t, len: size_t) -> ssize_t { @@ -69,7 +68,7 @@ pub extern "system" fn pgp_reader_read(errp: Option<&mut *mut failure::Error>, /// The file will be created if it does not exist, or be truncated /// otherwise. If you need more control, use `pgp_writer_from_fd`. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_writer_from_file(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_writer_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> *mut Box<Write> { ffi_make_fry_from_errp!(errp); @@ -161,7 +160,7 @@ pub extern "system" fn pgp_writer_free(writer: Option<&mut Box<Write>>) { /// Writes up to `len` bytes of `buf` into `writer`. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_writer_write(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_writer_write(errp: Option<&mut *mut ::error::Error>, writer: *mut Box<Write>, buf: *const uint8_t, len: size_t) -> ssize_t { diff --git a/openpgp-ffi/src/packet/key.rs b/openpgp-ffi/src/packet/key.rs index 07f32753..9bac8089 100644 --- a/openpgp-ffi/src/packet/key.rs +++ b/openpgp-ffi/src/packet/key.rs @@ -149,7 +149,7 @@ pub extern "system" fn pgp_key_public_key_bits(key: *const packet::Key) /// /// Fails if the secret key is missing, or encrypted. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_key_into_key_pair(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_key_into_key_pair(errp: Option<&mut *mut ::error::Error>, key: *mut packet::Key) -> *mut self::openpgp::crypto::KeyPair { diff --git a/openpgp-ffi/src/packet/pkesk.rs b/openpgp-ffi/src/packet/pkesk.rs index 17e7ab5b..4f528523 100644 --- a/openpgp-ffi/src/packet/pkesk.rs +++ b/openpgp-ffi/src/packet/pkesk.rs @@ -27,7 +27,7 @@ pub extern "system" fn pgp_pkesk_recipient(pkesk: *const PKESK) /// is not written to it. Either way, `key_len` is set to the size of /// the session key. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_pkesk_decrypt(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_pkesk_decrypt(errp: Option<&mut *mut ::error::Error>, pkesk: *const PKESK, secret_key: *const Key, algo: *mut uint8_t, // XXX diff --git a/openpgp-ffi/src/packet/skesk.rs b/openpgp-ffi/src/packet/skesk.rs index 52898513..98f5e467 100644 --- a/openpgp-ffi/src/packet/skesk.rs +++ b/openpgp-ffi/src/packet/skesk.rs @@ -16,7 +16,7 @@ use error::Status; /// is not written to it. Either way, `key_len` is set to the size of /// the session key. #[::ffi_catch_abort] #[no_mangle] -pub extern "system" fn pgp_skesk_decrypt(errp: Option<&mut *mut failure::Error>, +pub extern "system" fn pgp_skesk_decrypt(errp: Option<&mut *mut ::error::Error>, skesk: *const Packet, password: *const uint8_t, password_len: size_t, diff --git a/openpgp-ffi/src/packet_pile.rs b/openpgp-ffi/src/packet_pile.rs index 326aeafb..ad91bed3 100644 --- a/openpgp-ffi/src/packet_pile.rs +++ b/openpgp-ffi/src/packet_pile.rs @@ -38,7 +38,7 @@ pub struct PacketPile(openpgp::PacketPile); /// /// Note: this interface *does* buffer the contents of packets. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_packet_pile_from_reader(errp: Option<&mut *mut failure::Error>, +fn pgp_packet_pile_from_reader(errp: Option<&mut *mut ::error::Error>, reader: *mut Box<Read>) -> Maybe<PacketPile> { let reader = ffi_param_ref_mut!(reader); @@ -50,7 +50,7 @@ fn pgp_packet_pile_from_reader(errp: Option<&mut *mut failure::Error>, /// /// See `pgp_packet_pile_from_reader` for more details and caveats. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_packet_pile_from_file(errp: Option<&mut *mut failure::Error>, +fn pgp_packet_pile_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> Maybe<PacketPile> { let filename = ffi_param_cstr!(filename).to_string_lossy().into_owned(); @@ -61,7 +61,7 @@ fn pgp_packet_pile_from_file(errp: Option<&mut *mut failure::Error>, /// /// See `pgp_packet_pile_from_reader` for more details and caveats. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_packet_pile_from_bytes(errp: Option<&mut *mut failure::Error>, +fn pgp_packet_pile_from_bytes(errp: Option<&mut *mut ::error::Error>, b: *const uint8_t, len: size_t) -> Maybe<PacketPile> { assert!(!b.is_null()); @@ -74,7 +74,7 @@ fn pgp_packet_pile_from_bytes(errp: Option<&mut *mut failure::Error>, /// Serializes the packet pile. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_packet_pile_serialize(errp: Option<&mut *mut failure::Error>, +fn pgp_packet_pile_serialize(errp: Option<&mut *mut ::error::Error>, packet_pile: *const PacketPile, writer: *mut Box<Write>) -> Status { diff --git a/openpgp-ffi/src/parse.rs b/openpgp-ffi/src/parse.rs index c5d7d626..72d55d30 100644 --- a/openpgp-ffi/src/parse.rs +++ b/openpgp-ffi/src/parse.rs @@ -26,6 +26,7 @@ use self::openpgp::parse::{ }; use error::Status; +use MoveIntoRaw; /// Starts parsing OpenPGP packets stored in a `pgp_reader_t` /// object. @@ -34,7 +35,7 @@ use error::Status; /// the stream. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_from_reader<'a> - (errp: Option<&mut *mut failure::Error>, reader: *mut Box<'a + Read>) + (errp: Option<&mut *mut ::error::Error>, reader: *mut Box<'a + Read>) -> *mut PacketParserResult<'a> { ffi_make_fry_from_errp!(errp); let reader = ffi_param_ref_mut!(reader); @@ -47,7 +48,7 @@ pub extern "system" fn pgp_packet_parser_from_reader<'a> /// the stream. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_from_file - (errp: Option<&mut *mut failure::Error>, filename: *const c_char) + (errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> *mut PacketParserResult<'static> { ffi_make_fry_from_errp!(errp); let filename = ffi_param_cstr!(filename).to_string_lossy().into_owned(); @@ -60,7 +61,7 @@ pub extern "system" fn pgp_packet_parser_from_file /// the stream. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_from_bytes - (errp: Option<&mut *mut failure::Error>, b: *const uint8_t, len: size_t) + (errp: Option<&mut *mut ::error::Error>, b: *const uint8_t, len: size_t) -> *mut PacketParserResult<'static> { ffi_make_fry_from_errp!(errp); assert!(!b.is_null()); @@ -193,7 +194,7 @@ pub extern "system" fn pgp_packet_parser_recursion_depth /// Consumes the given packet parser. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_next<'a> - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, pp: *mut PacketParser<'a>, old_packet: Option<&mut *mut Packet>, ppr: Option<&mut *mut PacketParserResult<'a>>) @@ -237,7 +238,7 @@ pub extern "system" fn pgp_packet_parser_next<'a> /// Consumes the given packet parser. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_recurse<'a> - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, pp: *mut PacketParser<'a>, old_packet: Option<&mut *mut Packet>, ppr: Option<&mut *mut PacketParserResult<'a>>) @@ -267,7 +268,7 @@ pub extern "system" fn pgp_packet_parser_recurse<'a> /// content is small. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_buffer_unread_content<'a> - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, pp: *mut PacketParser<'a>, len: *mut usize) -> *const uint8_t { @@ -285,7 +286,7 @@ pub extern "system" fn pgp_packet_parser_buffer_unread_content<'a> /// `PacketParserBuild` to customize the default behavior. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_finish<'a> - (errp: Option<&mut *mut failure::Error>, pp: *mut PacketParser<'a>, + (errp: Option<&mut *mut ::error::Error>, pp: *mut PacketParser<'a>, packet: Option<&mut *const Packet>) -> Status { @@ -301,7 +302,7 @@ pub extern "system" fn pgp_packet_parser_finish<'a> Err(e) => { let status = Status::from(&e); if let Some(errp) = errp { - *errp = box_raw!(e); + *errp = e.move_into_raw(); } status }, @@ -319,7 +320,7 @@ pub extern "system" fn pgp_packet_parser_finish<'a> /// returns `Error::InvalidOperation`. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_packet_parser_decrypt<'a> - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, pp: *mut PacketParser<'a>, algo: uint8_t, // XXX key: *const uint8_t, key_len: size_t) diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs index f94cb2ad..93c0895d 100644 --- a/openpgp-ffi/src/serialize.rs +++ b/openpgp-ffi/src/serialize.rs @@ -50,7 +50,7 @@ pub extern "system" fn pgp_writer_stack_message /// Writes up to `len` bytes of `buf` into `writer`. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_writer_stack_write - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, writer: *mut writer::Stack<'static, Cookie>, buf: *const uint8_t, len: size_t) -> ssize_t @@ -71,7 +71,7 @@ pub extern "system" fn pgp_writer_stack_write /// EINTR. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_writer_stack_write_all - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, writer: *mut writer::Stack<'static, Cookie>, buf: *const uint8_t, len: size_t) -> Status @@ -88,7 +88,7 @@ pub extern "system" fn pgp_writer_stack_write_all /// Finalizes this writer, returning the underlying writer. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_writer_stack_finalize_one - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, writer: *mut writer::Stack<'static, Cookie>) -> *mut writer::Stack<'static, Cookie> { @@ -104,7 +104,7 @@ pub extern "system" fn pgp_writer_stack_finalize_one /// Finalizes all writers, tearing down the whole stack. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_writer_stack_finalize - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, writer: *mut writer::Stack<'static, Cookie>) -> Status { @@ -124,7 +124,7 @@ pub extern "system" fn pgp_writer_stack_finalize /// body is short, using full length encoding. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_arbitrary_writer_new - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, inner: *mut writer::Stack<'static, Cookie>, tag: uint8_t) -> *mut writer::Stack<'static, Cookie> @@ -141,7 +141,7 @@ pub extern "system" fn pgp_arbitrary_writer_new /// writes a signature packet. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_signer_new - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, inner: *mut writer::Stack<'static, Cookie>, signers: *const *mut Box<self::openpgp::crypto::Signer>, signers_len: size_t) @@ -165,7 +165,7 @@ pub extern "system" fn pgp_signer_new /// Creates a signer for a detached signature. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_signer_new_detached - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, inner: *mut writer::Stack<'static, Cookie>, signers: *const *mut Box<self::openpgp::crypto::Signer>, signers_len: size_t) @@ -192,7 +192,7 @@ pub extern "system" fn pgp_signer_new_detached /// body is short, using full length encoding. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_literal_writer_new - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, inner: *mut writer::Stack<'static, Cookie>) -> *mut writer::Stack<'static, Cookie> { @@ -214,7 +214,7 @@ pub extern "system" fn pgp_literal_writer_new /// preferences. #[::ffi_catch_abort] #[no_mangle] pub extern "system" fn pgp_encryptor_new - (errp: Option<&mut *mut failure::Error>, + (errp: Option<&mut *mut ::error::Error>, inner: *mut writer::Stack<'static, Cookie>, passwords: Option<&*const c_char>, passwords_len: size_t, recipients: Option<&&TPK>, recipients_len: size_t, diff --git a/openpgp-ffi/src/tpk.rs b/openpgp-ffi/src/tpk.rs index 4ebacea4..6cacb02f 100644 --- a/openpgp-ffi/src/tpk.rs +++ b/openpgp-ffi/src/tpk.rs @@ -58,7 +58,7 @@ pub struct TPK(openpgp::TPK); /// Returns the first TPK encountered in the reader. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_tpk_from_reader(errp: Option<&mut *mut failure::Error>, +fn pgp_tpk_from_reader(errp: Option<&mut *mut ::error::Error>, reader: *mut Box<Read>) -> Maybe<TPK> { let reader = ffi_param_ref_mut!(reader); @@ -67,7 +67,7 @@ fn pgp_tpk_from_reader(errp: Option<&mut *mut failure::Error>, /// Returns the first TPK encountered in the file. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_tpk_from_file(errp: Option<&mut *mut failure::Error>, +fn pgp_tpk_from_file(errp: Option<&mut *mut ::error::Error>, filename: *const c_char) -> Maybe<TPK> { let filename = ffi_param_cstr!(filename).to_string_lossy().into_owned(); @@ -78,7 +78,7 @@ fn pgp_tpk_from_file(errp: Option<&mut *mut failure::Error>, /// /// Consumes `m`. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_tpk_from_packet_pile(errp: Option<&mut *mut failure::Error>, +fn pgp_tpk_from_packet_pile(errp: Option<&mut *mut ::error::Error>, m: *mut PacketPile) -> Maybe<TPK> { let m = ffi_param_move!(m); @@ -89,7 +89,7 @@ fn pgp_tpk_from_packet_pile(errp: Option<&mut *mut failure::Error>, /// /// `buf` must be an OpenPGP-encoded TPK. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_tpk_from_bytes(errp: Option<&mut *mut failure::Error>, +fn pgp_tpk_from_bytes(errp: Option<&mut *mut ::error::Error>, b: *const uint8_t, len: size_t) -> Maybe<TPK> { assert!(!b.is_null()); @@ -104,7 +104,7 @@ fn pgp_tpk_from_bytes(errp: Option<&mut *mut failure::Error>, /// /// Consumes the packet parser result. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_tpk_from_packet_parser(errp: Option<&mut *mut failure::Error>, +fn pgp_tpk_from_packet_parser(errp: Option<&mut *mut ::error::Error>, ppr: *mut PacketParserResult) -> Maybe<TPK> { @@ -115,7 +115,7 @@ fn pgp_tpk_from_packet_parser(errp: Option<&mut *mut failure::Error>, /// Serializes the TPK. #[::ffi_catch_abort] #[no_mangle] pub extern "system" -fn pgp_tpk_serialize(errp: Option<&mut *mut failure::Error>, |