summaryrefslogtreecommitdiff
path: root/rust/src/collaboration/sync.rs
diff options
context:
space:
mode:
authorMason Reed <mason@vector35.com>2025-05-04 19:47:55 -0400
committerMason Reed <35282038+emesare@users.noreply.github.com>2025-05-12 17:45:24 -0400
commit788a8b7091bbdde77817030e0836d7a7a786fd99 (patch)
tree40e8f8d3c870788259a5acb5d14995cdc1656979 /rust/src/collaboration/sync.rs
parenta826c589dfc10c542deba7ca3343a462e02d6bde (diff)
[Rust] Simplify usage surrounding c strings
`cstring.as_ref().as_ptr() as *const c_char` -> `cstring.as_ptr()` `cstring.as_ref().as_ptr() as *mut _` -> `cstring.as_ptr()` `cstring.as_ptr() as *const c_char` -> `cstring.as_ptr()` With a few fixes for cstrings that might be dropped prematurely.
Diffstat (limited to 'rust/src/collaboration/sync.rs')
-rw-r--r--rust/src/collaboration/sync.rs12
1 files changed, 6 insertions, 6 deletions
diff --git a/rust/src/collaboration/sync.rs b/rust/src/collaboration/sync.rs
index 4c112336..5afb8923 100644
--- a/rust/src/collaboration/sync.rs
+++ b/rust/src/collaboration/sync.rs
@@ -63,7 +63,7 @@ pub fn download_file_with_progress<S: AsCStr, F: ProgressCallback>(
let result = unsafe {
BNCollaborationDownloadFile(
file.handle.as_ptr(),
- db_path.as_ref().as_ptr() as *const c_char,
+ db_path.as_ptr(),
Some(F::cb_progress_callback),
&mut progress as *mut F as *mut c_void,
)
@@ -239,7 +239,7 @@ where
let success = unsafe {
BNCollaborationDownloadDatabaseForFile(
file.handle.as_ptr(),
- db_path.as_ref().as_ptr() as *const c_char,
+ db_path.as_ptr(),
force,
Some(F::cb_progress_callback),
&mut progress as *mut _ as *mut c_void,
@@ -485,7 +485,7 @@ pub fn set_snapshot_author<S: AsCStr>(
BNCollaborationSetSnapshotAuthor(
database.handle.as_ptr(),
snapshot.handle.as_ptr(),
- author.as_ref().as_ptr() as *const c_char,
+ author.as_ptr(),
)
};
success.then_some(()).ok_or(())
@@ -658,7 +658,7 @@ pub fn get_remote_snapshot_from_local_type_archive<S: AsCStr>(
let value = unsafe {
BNCollaborationGetRemoteSnapshotFromLocalTypeArchive(
type_archive.handle.as_ptr(),
- snapshot_id.as_ref().as_ptr() as *const c_char,
+ snapshot_id.as_ptr(),
)
};
NonNull::new(value).map(|handle| unsafe { RemoteSnapshot::ref_from_raw(handle) })
@@ -687,7 +687,7 @@ pub fn is_type_archive_snapshot_ignored<S: AsCStr>(
unsafe {
BNCollaborationIsTypeArchiveSnapshotIgnored(
type_archive.handle.as_ptr(),
- snapshot_id.as_ref().as_ptr() as *const c_char,
+ snapshot_id.as_ptr(),
)
}
}
@@ -713,7 +713,7 @@ pub fn download_type_archive_with_progress<S: AsCStr, F: ProgressCallback>(
let success = unsafe {
BNCollaborationDownloadTypeArchive(
file.handle.as_ptr(),
- db_path.as_ref().as_ptr() as *const c_char,
+ db_path.as_ptr(),
Some(F::cb_progress_callback),
&mut progress as *mut F as *mut c_void,
&mut value,