From 1142d0d783fed5d58eb0c38c7c035854bd4dbd73 Mon Sep 17 00:00:00 2001 From: Nora Widdecke Date: Thu, 17 Sep 2020 17:19:31 +0200 Subject: ffi: Fix improper_ctypes_definitions warnings. - Rust 1.46.0 warns that the callback function types are not FFI-safe. This declares them `extern fn`, as the compiler suggests. --- openpgp-ffi/src/io.rs | 4 ++-- openpgp-ffi/src/parse/stream.rs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) (limited to 'openpgp-ffi') diff --git a/openpgp-ffi/src/io.rs b/openpgp-ffi/src/io.rs index b2690db3..ab07961e 100644 --- a/openpgp-ffi/src/io.rs +++ b/openpgp-ffi/src/io.rs @@ -74,7 +74,7 @@ pub extern "C" fn pgp_reader_from_bytes(buf: *const u8, } /// The callback type for the generic callback-based reader interface. -type ReaderCallbackFn = fn(*mut c_void, *const c_void, size_t) -> ssize_t; +type ReaderCallbackFn = extern fn(*mut c_void, *const c_void, size_t) -> ssize_t; /// Creates an reader from a callback and cookie. /// @@ -293,7 +293,7 @@ impl Write for WriterAlloc { } /// The callback type for the generic callback-based writer interface. -type WriterCallbackFn = fn(*mut c_void, *const c_void, size_t) -> ssize_t; +type WriterCallbackFn = extern fn(*mut c_void, *const c_void, size_t) -> ssize_t; /// Creates an writer from a callback and cookie. /// diff --git a/openpgp-ffi/src/parse/stream.rs b/openpgp-ffi/src/parse/stream.rs index abcb76de..ff5de6ed 100644 --- a/openpgp-ffi/src/parse/stream.rs +++ b/openpgp-ffi/src/parse/stream.rs @@ -389,7 +389,7 @@ type FreeCallback = fn(*mut c_void); /// /// If the free callback is not NULL, then it is called to free the /// returned array of Certs. -type GetPublicKeysCallback = fn(*mut HelperCookie, +type GetPublicKeysCallback = extern fn(*mut HelperCookie, *const *mut keyid::KeyID, usize, &mut *mut *mut Cert, *mut usize, *mut FreeCallback) -> Status; @@ -398,7 +398,7 @@ type GetPublicKeysCallback = fn(*mut HelperCookie, /// /// This function is called on every packet that the decryptor /// observes. -type InspectCallback = fn(*mut HelperCookie, *const PacketParser) -> Status; +type InspectCallback = extern fn(*mut HelperCookie, *const PacketParser) -> Status; /// Decrypts the message. /// @@ -410,7 +410,7 @@ type InspectCallback = fn(*mut HelperCookie, *const PacketParser) -> Status; /// /// XXX: This needlessly flattens the complex errors returned by the /// `decrypt` function into a status. -type DecryptCallback = fn(*mut HelperCookie, +type DecryptCallback = extern fn(*mut HelperCookie, *const *const PKESK, usize, *const *const SKESK, usize, u8, // XXX SymmetricAlgorithm @@ -425,7 +425,7 @@ type DecryptCallback = fn(*mut HelperCookie, /// /// If the result is not Status::Success, then this aborts the /// Verification. -type CheckCallback = fn(*mut HelperCookie, +type CheckCallback = extern fn(*mut HelperCookie, *const MessageStructure) -> Status; -- cgit v1.2.3