summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi/src
diff options
context:
space:
mode:
authorNeal H. Walfield <neal@pep.foundation>2019-05-11 14:48:09 +0200
committerNeal H. Walfield <neal@pep.foundation>2019-05-11 14:48:09 +0200
commit5a2688066b934f73ff4e69640f2bc47211a84451 (patch)
treebc7c83efc28b9df3cfb8b0b1bf0198be623ffcaa /openpgp-ffi/src
parentccaccf692688451e984e75b2d020a7077dc15546 (diff)
openpgp: Make {is,possible}_{message,keyring,tpk} return a Result
- PacketParserEOF::is_message, PacketParserEOF::is_keyring, PacketParserEOF::is_tpk, PacketParserResult::possible_message, PacketParserResult::possible_keyring, and PacketParserResult::possible_tpk returned a boolean. - Change them to return a Result<()> instead, which is more Rusty, and, in particular, allows the caller to determine why the message didn't parse.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r--openpgp-ffi/src/parse/mod.rs6
1 files changed, 4 insertions, 2 deletions
diff --git a/openpgp-ffi/src/parse/mod.rs b/openpgp-ffi/src/parse/mod.rs
index 02fc4b27..df13bcbd 100644
--- a/openpgp-ffi/src/parse/mod.rs
+++ b/openpgp-ffi/src/parse/mod.rs
@@ -92,11 +92,13 @@ pub extern "C" fn pgp_packet_parser_free(pp: Option<&mut PacketParser>) {
/// Frees the packet parser EOF object.
#[::sequoia_ffi_macros::extern_fn] #[no_mangle]
pub extern "C" fn pgp_packet_parser_eof_is_message(
+ errp: Option<&mut *mut ::error::Error>,
eof: *const PacketParserEOF) -> bool
{
+ ffi_make_fry_from_errp!(errp);
let eof = ffi_param_ref!(eof);
-
- eof.is_message()
+ ffi_try_or!(eof.is_message(), false);
+ true
}
/// Frees the packet parser EOF object.