mirror of
https://github.com/ArcaneChat/core.git
synced 2026-07-03 14:05:33 +02:00
chore: dc_is_blobdir_path() -> bool
This commit is contained in:
+2
-3
@@ -443,7 +443,7 @@ unsafe fn prepare_msg_common<'a>(
|
||||
(*msg).type_0 as libc::c_int,
|
||||
);
|
||||
current_block = 2171833246886114521;
|
||||
} else if (*msg).state == 18i32 && 0 == dc_is_blobdir_path(context, pathNfilename) {
|
||||
} else if (*msg).state == 18i32 && !dc_is_blobdir_path(context, pathNfilename) {
|
||||
dc_log_error(
|
||||
context,
|
||||
0i32,
|
||||
@@ -1105,8 +1105,7 @@ unsafe fn set_draft_raw(context: &Context, chat_id: uint32_t, msg: *mut dc_msg_t
|
||||
pathNfilename = dc_param_get((*msg).param, 'f' as i32, 0 as *const libc::c_char);
|
||||
if pathNfilename.is_null() {
|
||||
current_block = 14513523936503887211;
|
||||
} else if 0 != dc_msg_is_increation(msg)
|
||||
&& 0 == dc_is_blobdir_path(context, pathNfilename)
|
||||
} else if 0 != dc_msg_is_increation(msg) && !dc_is_blobdir_path(context, pathNfilename)
|
||||
{
|
||||
current_block = 14513523936503887211;
|
||||
} else if 0 == dc_make_rel_and_copy(context, &mut pathNfilename) {
|
||||
|
||||
+4
-10
@@ -1386,15 +1386,9 @@ pub unsafe fn dc_get_fine_pathNfilename(
|
||||
ret
|
||||
}
|
||||
|
||||
// TODO should return bool /rtn
|
||||
pub unsafe fn dc_is_blobdir_path(context: &Context, path: *const libc::c_char) -> libc::c_int {
|
||||
if strncmp(path, context.get_blobdir(), strlen(context.get_blobdir())) == 0i32
|
||||
|| strncmp(path, b"$BLOBDIR\x00" as *const u8 as *const libc::c_char, 8) == 0i32
|
||||
{
|
||||
return 1i32;
|
||||
}
|
||||
|
||||
0
|
||||
pub unsafe fn dc_is_blobdir_path(context: &Context, path: *const libc::c_char) -> bool {
|
||||
(strncmp(path, context.get_blobdir(), strlen(context.get_blobdir())) == 0
|
||||
|| strncmp(path, b"$BLOBDIR\x00" as *const u8 as *const libc::c_char, 8) == 0)
|
||||
}
|
||||
|
||||
pub unsafe fn dc_make_rel_path(context: &Context, path: *mut *mut libc::c_char) {
|
||||
@@ -1416,7 +1410,7 @@ pub unsafe fn dc_make_rel_and_copy(context: &Context, path: *mut *mut libc::c_ch
|
||||
let mut filename: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
let mut blobdir_path: *mut libc::c_char = 0 as *mut libc::c_char;
|
||||
if !(path.is_null() || (*path).is_null()) {
|
||||
if 0 != dc_is_blobdir_path(context, *path) {
|
||||
if dc_is_blobdir_path(context, *path) {
|
||||
dc_make_rel_path(context, path);
|
||||
success = 1i32
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user