summaryrefslogtreecommitdiffstats
path: root/openpgp-ffi
diff options
context:
space:
mode:
authorNora Widdecke <nora@sequoia-pgp.org>2020-09-17 17:19:31 +0200
committerJustus Winter <justus@sequoia-pgp.org>2020-09-21 13:39:09 +0200
commit1142d0d783fed5d58eb0c38c7c035854bd4dbd73 (patch)
tree6f0df296dab1a27cfacc4b4279a5ae2487c53c43 /openpgp-ffi
parent12590db7f8c1c5f3616fd7d9925afadff56f0324 (diff)
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.
Diffstat (limited to 'openpgp-ffi')
-rw-r--r--openpgp-ffi/src/io.rs4
-rw-r--r--openpgp-ffi/src/parse/stream.rs8
2 files changed, 6 insertions, 6 deletions
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;