diff options
author | Neal H. Walfield <neal@pep.foundation> | 2020-03-13 14:11:37 +0100 |
---|---|---|
committer | Neal H. Walfield <neal@pep.foundation> | 2020-03-13 14:19:47 +0100 |
commit | 1b6683e5ac362ebed79ad8d42018728b0db7a16e (patch) | |
tree | d686de75ac428c1c7bd6d82408817bf90839dbcf /openpgp-ffi/src | |
parent | 99fc174dafc91db07cd9689dbe659ea4b531fbfe (diff) |
openpgp: Change pgp_writer_stack_message to take a reference.
- pgp_writer_stack_message should take a reference to the writer and
not take ownership of the writer.
- This is essential for the armor writer, which needs to be
explicitly finalized.
Diffstat (limited to 'openpgp-ffi/src')
-rw-r--r-- | openpgp-ffi/src/serialize.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/openpgp-ffi/src/serialize.rs b/openpgp-ffi/src/serialize.rs index e9fece8d..4c623ffb 100644 --- a/openpgp-ffi/src/serialize.rs +++ b/openpgp-ffi/src/serialize.rs @@ -41,12 +41,16 @@ use super::cert::KeyIterWrapper; use super::cert::ValidKeyIterWrapper; /// Streams an OpenPGP message. +/// +/// The returned `writer::Stack` does not take ownership of the +/// `Writer`; the caller must free it after destroying the +/// `writer::Stack`. #[::sequoia_ffi_macros::extern_fn] #[no_mangle] pub extern "C" fn pgp_writer_stack_message (writer: *mut super::io::Writer) -> *mut writer::Stack<'static, Cookie> { - box_raw!(Message::new(writer.move_from_raw())) + box_raw!(Message::new(writer.ref_mut_raw())) } /// Writes up to `len` bytes of `buf` into `writer`. |