mirror of
https://github.com/ostreedev/ostree.git
synced 2024-12-22 17:35:55 +03:00
Use pointer coercion instead of messing with -sys
This commit is contained in:
parent
d55d1b1d43
commit
4cd981d01b
@ -32,6 +32,12 @@ impl FromGlibPtrFull<*mut [u8; 32]> for Checksum {
|
||||
}
|
||||
}
|
||||
|
||||
impl FromGlibPtrFull<*mut [*mut u8; 32]> for Checksum {
|
||||
unsafe fn from_glib_full(ptr: *mut [*mut u8; 32]) -> Self {
|
||||
Checksum::new(ptr as *mut u8 as *mut [u8; 32])
|
||||
}
|
||||
}
|
||||
|
||||
impl FromGlibPtrFull<*mut u8> for Checksum {
|
||||
unsafe fn from_glib_full(ptr: *mut u8) -> Self {
|
||||
Checksum::new(ptr as *mut [u8; 32])
|
||||
|
@ -129,7 +129,7 @@ impl Repo {
|
||||
unsafe {
|
||||
let mut error = ptr::null_mut();
|
||||
let mut out_csum = ptr::null_mut();
|
||||
let _ = ostree_sys::fixed::ostree_repo_write_content(
|
||||
let _ = ostree_sys::ostree_repo_write_content(
|
||||
self.to_glib_none().0,
|
||||
expected_checksum.to_glib_none().0,
|
||||
object_input.as_ref().to_glib_none().0,
|
||||
@ -156,7 +156,7 @@ impl Repo {
|
||||
unsafe {
|
||||
let mut error = ptr::null_mut();
|
||||
let mut out_csum = ptr::null_mut();
|
||||
let _ = ostree_sys::fixed::ostree_repo_write_metadata(
|
||||
let _ = ostree_sys::ostree_repo_write_metadata(
|
||||
self.to_glib_none().0,
|
||||
objtype.to_glib(),
|
||||
expected_checksum.to_glib_none().0,
|
||||
|
@ -1,29 +1 @@
|
||||
pub use libc::stat;
|
||||
|
||||
pub mod fixed {
|
||||
use crate::{OstreeObjectType, OstreeRepo};
|
||||
use glib::gboolean;
|
||||
use libc::c_char;
|
||||
|
||||
extern "C" {
|
||||
pub fn ostree_repo_write_content(
|
||||
self_: *mut OstreeRepo,
|
||||
expected_checksum: *const c_char,
|
||||
object_input: *mut gio::GInputStream,
|
||||
length: u64,
|
||||
out_csum: *mut *mut [u8; 32],
|
||||
cancellable: *mut gio::GCancellable,
|
||||
error: *mut *mut glib::GError,
|
||||
) -> gboolean;
|
||||
|
||||
pub fn ostree_repo_write_metadata(
|
||||
self_: *mut OstreeRepo,
|
||||
objtype: OstreeObjectType,
|
||||
expected_checksum: *const c_char,
|
||||
object: *mut glib::GVariant,
|
||||
out_csum: *mut *mut [u8; 32],
|
||||
cancellable: *mut gio::GCancellable,
|
||||
error: *mut *mut glib::GError,
|
||||
) -> gboolean;
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user