mirror of
https://github.com/zerotier/ZeroTierOne.git
synced 2025-07-24 03:02:50 +02:00
Rust warning removal, clippy allows, update library versions.
This commit is contained in:
parent
5fb8d2aa37
commit
67e8f344ac
7 changed files with 838 additions and 657 deletions
1440
rustybits/Cargo.lock
generated
1440
rustybits/Cargo.lock
generated
File diff suppressed because it is too large
Load diff
|
@ -8,7 +8,7 @@ fn main() {
|
|||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
|
||||
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||
let output_file = target_dir().join(format!("{}.h", package_name)).display().to_string();
|
||||
let output_file = target_dir().join(format!("{package_name}.h")).display().to_string();
|
||||
|
||||
let config = Config {
|
||||
language: Language::C,
|
||||
|
|
|
@ -10,6 +10,8 @@
|
|||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
|
||||
#![allow(clippy::uninlined_format_args, clippy::missing_safety_doc)]
|
||||
|
||||
use std::ffi::CStr;
|
||||
use std::os::raw::c_char;
|
||||
|
||||
|
@ -17,7 +19,7 @@ use crate::NetworkJoinedParams;
|
|||
use crate::SmeeClient;
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn smee_client_new(
|
||||
pub unsafe extern "C" fn smee_client_new(
|
||||
temporal_url: *const c_char,
|
||||
namespace: *const c_char,
|
||||
task_queue: *const c_char,
|
||||
|
@ -47,7 +49,7 @@ pub extern "C" fn smee_client_new(
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
|
||||
pub unsafe extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
|
||||
if ptr.is_null() {
|
||||
return;
|
||||
}
|
||||
|
@ -60,7 +62,7 @@ pub extern "C" fn smee_client_delete(ptr: *mut SmeeClient) {
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn smee_client_notify_network_joined(
|
||||
pub unsafe extern "C" fn smee_client_notify_network_joined(
|
||||
smee_instance: *mut SmeeClient,
|
||||
network_id: *const c_char,
|
||||
member_id: *const c_char,
|
||||
|
@ -85,7 +87,7 @@ pub extern "C" fn smee_client_notify_network_joined(
|
|||
match smee.notify_network_joined(params) {
|
||||
Ok(()) => true,
|
||||
Err(e) => {
|
||||
println!("error notifying network joined: {0}", e.to_string());
|
||||
println!("error notifying network joined: {0}", e);
|
||||
false
|
||||
}
|
||||
}
|
||||
|
|
|
@ -77,6 +77,9 @@ impl SmeeClient {
|
|||
id_reuse_policy: WorkflowIdReusePolicy::RejectDuplicate,
|
||||
id_conflict_policy: WorkflowIdConflictPolicy::Fail,
|
||||
execution_timeout: None,
|
||||
completion_callbacks: Default::default(),
|
||||
links: Default::default(),
|
||||
priority: None,
|
||||
run_timeout: None,
|
||||
task_timeout: None,
|
||||
cron_schedule: None,
|
||||
|
|
|
@ -8,7 +8,7 @@ fn main() {
|
|||
let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap();
|
||||
|
||||
let package_name = env::var("CARGO_PKG_NAME").unwrap();
|
||||
let output_file = target_dir().join(format!("{}.h", package_name)).display().to_string();
|
||||
let output_file = target_dir().join(format!("{package_name}.h")).display().to_string();
|
||||
|
||||
let config = Config {
|
||||
language: Language::C,
|
||||
|
|
|
@ -24,7 +24,7 @@ use crate::ZeroIDC;
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_new(
|
||||
pub unsafe extern "C" fn zeroidc_new(
|
||||
issuer: *const c_char,
|
||||
client_id: *const c_char,
|
||||
auth_endpoint: *const c_char,
|
||||
|
@ -78,7 +78,7 @@ pub extern "C" fn zeroidc_new(
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
|
||||
pub unsafe extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
|
||||
if ptr.is_null() {
|
||||
return;
|
||||
}
|
||||
|
@ -101,7 +101,7 @@ pub extern "C" fn zeroidc_delete(ptr: *mut ZeroIDC) {
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
|
||||
pub unsafe extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
|
||||
let idc = unsafe {
|
||||
assert!(!ptr.is_null());
|
||||
&mut *ptr
|
||||
|
@ -117,7 +117,7 @@ pub extern "C" fn zeroidc_start(ptr: *mut ZeroIDC) {
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
|
||||
pub unsafe extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
|
||||
let idc = unsafe {
|
||||
assert!(!ptr.is_null());
|
||||
&mut *ptr
|
||||
|
@ -133,7 +133,7 @@ pub extern "C" fn zeroidc_stop(ptr: *mut ZeroIDC) {
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
|
||||
pub unsafe extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
|
||||
let idc = unsafe {
|
||||
assert!(!ptr.is_null());
|
||||
&mut *ptr
|
||||
|
@ -143,7 +143,7 @@ pub extern "C" fn zeroidc_is_running(ptr: *mut ZeroIDC) -> bool {
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
|
||||
pub unsafe extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
|
||||
let id = unsafe {
|
||||
assert!(!ptr.is_null());
|
||||
&mut *ptr
|
||||
|
@ -160,7 +160,11 @@ pub extern "C" fn zeroidc_get_exp_time(ptr: *mut ZeroIDC) -> u64 {
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_set_nonce_and_csrf(ptr: *mut ZeroIDC, csrf_token: *const c_char, nonce: *const c_char) {
|
||||
pub unsafe extern "C" fn zeroidc_set_nonce_and_csrf(
|
||||
ptr: *mut ZeroIDC,
|
||||
csrf_token: *const c_char,
|
||||
nonce: *const c_char,
|
||||
) {
|
||||
let idc = unsafe {
|
||||
assert!(!ptr.is_null());
|
||||
&mut *ptr
|
||||
|
@ -190,7 +194,7 @@ pub extern "C" fn zeroidc_set_nonce_and_csrf(ptr: *mut ZeroIDC, csrf_token: *con
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn free_cstr(s: *mut c_char) {
|
||||
pub unsafe extern "C" fn free_cstr(s: *mut c_char) {
|
||||
if s.is_null() {
|
||||
println!("passed a null object");
|
||||
return;
|
||||
|
@ -209,7 +213,7 @@ pub extern "C" fn free_cstr(s: *mut c_char) {
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
|
||||
pub unsafe extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
|
||||
if ptr.is_null() {
|
||||
println!("passed a null object");
|
||||
return std::ptr::null_mut();
|
||||
|
@ -228,7 +232,7 @@ pub extern "C" fn zeroidc_get_auth_url(ptr: *mut ZeroIDC) -> *mut c_char {
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char) -> *mut c_char {
|
||||
pub unsafe extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char) -> *mut c_char {
|
||||
if idc.is_null() {
|
||||
println!("idc is null");
|
||||
return std::ptr::null_mut();
|
||||
|
@ -265,7 +269,7 @@ pub extern "C" fn zeroidc_token_exchange(idc: *mut ZeroIDC, code: *const c_char)
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_get_url_param_value(param: *const c_char, path: *const c_char) -> *mut c_char {
|
||||
pub unsafe extern "C" fn zeroidc_get_url_param_value(param: *const c_char, path: *const c_char) -> *mut c_char {
|
||||
if param.is_null() {
|
||||
println!("param is null");
|
||||
return std::ptr::null_mut();
|
||||
|
@ -292,7 +296,7 @@ pub extern "C" fn zeroidc_get_url_param_value(param: *const c_char, path: *const
|
|||
}
|
||||
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_network_id_from_state(state: *const c_char) -> *mut c_char {
|
||||
pub unsafe extern "C" fn zeroidc_network_id_from_state(state: *const c_char) -> *mut c_char {
|
||||
if state.is_null() {
|
||||
println!("state is null");
|
||||
return std::ptr::null_mut();
|
||||
|
@ -318,7 +322,7 @@ pub extern "C" fn zeroidc_network_id_from_state(state: *const c_char) -> *mut c_
|
|||
target_os = "macos",
|
||||
))]
|
||||
#[no_mangle]
|
||||
pub extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) {
|
||||
pub unsafe extern "C" fn zeroidc_kick_refresh_thread(idc: *mut ZeroIDC) {
|
||||
if idc.is_null() {
|
||||
println!("idc is null");
|
||||
return;
|
||||
|
|
|
@ -10,6 +10,12 @@
|
|||
* of this software will be governed by version 2.0 of the Apache License.
|
||||
*/
|
||||
|
||||
#![allow(
|
||||
clippy::uninlined_format_args,
|
||||
clippy::missing_safety_doc,
|
||||
clippy::option_map_unit_fn
|
||||
)]
|
||||
|
||||
pub mod error;
|
||||
pub mod ext;
|
||||
|
||||
|
@ -373,7 +379,7 @@ impl ZeroIDC {
|
|||
return;
|
||||
}
|
||||
|
||||
let need_verifier = matches!(i.pkce_verifier, None);
|
||||
let need_verifier = i.pkce_verifier.is_none();
|
||||
|
||||
let csrf_diff = if let Some(csrf) = i.csrf_token.clone() {
|
||||
*csrf.secret() != csrf_token
|
||||
|
|
Loading…
Add table
Reference in a new issue