Skip to content

Commit

Permalink
fix build of diode-file-bindings because of aux module refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
github-af authored and r3dlight committed Jul 29, 2024
1 parent bce6302 commit 0334870
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions diode-file-bindings/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#![allow(unsafe_code)]

use diode::file;
use diode::aux::{self,file};
use std::{
ffi::{c_char, CStr},
net::SocketAddr,
Expand All @@ -14,7 +14,7 @@ use std::{
pub unsafe extern "C" fn diode_new_config(
ptr_addr: *const c_char,
buffer_size: u32,
) -> *mut file::Config<file::DiodeSend> {
) -> *mut file::Config<aux::DiodeSend> {
if ptr_addr.is_null() {
return ptr::null_mut();
}
Expand All @@ -23,7 +23,7 @@ pub unsafe extern "C" fn diode_new_config(
let socket_addr = SocketAddr::from_str(&rust_addr).expect("ip:port");

let config = Box::new(file::Config {
diode: file::DiodeSend::Tcp(socket_addr),
diode: aux::DiodeSend::Tcp(socket_addr),
buffer_size: buffer_size as usize,
hash: false,
});
Expand All @@ -32,7 +32,7 @@ pub unsafe extern "C" fn diode_new_config(

#[no_mangle]
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn diode_free_config(ptr: *mut file::Config<file::DiodeSend>) {
pub unsafe extern "C" fn diode_free_config(ptr: *mut file::Config<aux::DiodeSend>) {
if ptr.is_null() {
return;
}
Expand All @@ -44,7 +44,7 @@ pub unsafe extern "C" fn diode_free_config(ptr: *mut file::Config<file::DiodeSen
#[no_mangle]
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn diode_send_file(
ptr: *mut file::Config<file::DiodeSend>,
ptr: *mut file::Config<aux::DiodeSend>,
ptr_filepath: *const c_char,
) -> u32 {
if ptr.is_null() {
Expand All @@ -64,19 +64,19 @@ pub unsafe extern "C" fn diode_send_file(
#[no_mangle]
#[allow(clippy::missing_safety_doc)]
pub unsafe extern "C" fn diode_receive_files(
ptr: *mut file::Config<file::DiodeSend>,
ptr: *mut file::Config<aux::DiodeSend>,
ptr_odir: *const c_char,
) {
if ptr.is_null() {
return;
}
let config = unsafe { ptr.as_ref() }.expect("config");
let file::DiodeSend::Tcp(socket_addr) = config.diode else {
let aux::DiodeSend::Tcp(socket_addr) = config.diode else {
return;
};

let config = file::Config {
diode: file::DiodeReceive {
diode: aux::DiodeReceive {
from_tcp: Some(socket_addr),
from_unix: None,
},
Expand Down

0 comments on commit 0334870

Please sign in to comment.