diff --git a/src/constants.rs b/src/constants.rs index 56b01ec18..b0aca01b7 100644 --- a/src/constants.rs +++ b/src/constants.rs @@ -1,5 +1,5 @@ //! Constants -#![allow(non_camel_case_types)] +#![allow(non_camel_case_types, dead_code)] use lazy_static::lazy_static; diff --git a/src/dc_array.rs b/src/dc_array.rs index dffa9d2ef..a2f744259 100644 --- a/src/dc_array.rs +++ b/src/dc_array.rs @@ -259,10 +259,7 @@ pub fn dc_array_new(initsize: size_t) -> *mut dc_array_t { dc_array_t::new(initsize).into_raw() } -fn dc_array_new_locations(initsize: size_t) -> *mut dc_array_t { - dc_array_t::new_locations(initsize).into_raw() -} - +#[cfg(test)] unsafe fn dc_array_empty(array: *mut dc_array_t) { assert!(!array.is_null()); diff --git a/src/dc_mimeparser.rs b/src/dc_mimeparser.rs index 978963133..b41f04d9a 100644 --- a/src/dc_mimeparser.rs +++ b/src/dc_mimeparser.rs @@ -61,11 +61,6 @@ pub struct dc_mimeparser_t<'a> { pub message_kml: Option, } -// deprecated -unsafe fn dc_no_compound_msgs() { - S_GENERATE_COMPOUND_MSGS = 0i32; -} - // deprecated: flag to switch generation of compound messages on and off. static mut S_GENERATE_COMPOUND_MSGS: libc::c_int = 1i32; diff --git a/src/dc_strencode.rs b/src/dc_strencode.rs index 1afd9cb3c..4aff165d3 100644 --- a/src/dc_strencode.rs +++ b/src/dc_strencode.rs @@ -331,6 +331,7 @@ pub unsafe fn dc_decode_header_words(in_0: *const libc::c_char) -> *mut libc::c_ out } +#[cfg(test)] unsafe fn dc_encode_modified_utf7( mut to_encode: *const libc::c_char, change_spaces: libc::c_int, @@ -475,12 +476,14 @@ unsafe fn dc_encode_modified_utf7( ******************************************************************************/ // UTF7 modified base64 alphabet +#[cfg(test)] static mut BASE64CHARS: [libc::c_char; 65] = [ 65, 66, 67, 68, 69, 70, 71, 72, 73, 74, 75, 76, 77, 78, 79, 80, 81, 82, 83, 84, 85, 86, 87, 88, 89, 90, 97, 98, 99, 100, 101, 102, 103, 104, 105, 106, 107, 108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119, 120, 121, 122, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 43, 44, 0, ]; +#[cfg(test)] unsafe fn dc_decode_modified_utf7( to_decode: *const libc::c_char, change_spaces: libc::c_int, diff --git a/src/dc_tools.rs b/src/dc_tools.rs index f93e9da10..2ba17566c 100644 --- a/src/dc_tools.rs +++ b/src/dc_tools.rs @@ -193,6 +193,7 @@ pub unsafe fn dc_null_terminate( out } +#[cfg(test)] unsafe fn dc_binary_to_uc_hex(buf: *const uint8_t, bytes: size_t) -> *mut libc::c_char { if buf.is_null() || bytes == 0 { return std::ptr::null_mut(); @@ -225,10 +226,6 @@ pub unsafe fn dc_remove_cr_chars(buf: *mut libc::c_char) { *p2 = 0 as libc::c_char; } -unsafe fn dc_unify_lineends(buf: *mut libc::c_char) { - dc_remove_cr_chars(buf); -} - /* replace bad UTF-8 characters by sequences of `_` (to avoid problems in filenames, we do not use eg. `?`) the function is useful if strings are unexpectingly encoded eg. as ISO-8859-1 */ #[allow(non_snake_case)] pub unsafe fn dc_replace_bad_utf8_chars(buf: *mut libc::c_char) { @@ -295,6 +292,7 @@ pub unsafe fn dc_replace_bad_utf8_chars(buf: *mut libc::c_char) { } } +#[cfg(test)] unsafe fn dc_utf8_strlen(s: *const libc::c_char) -> size_t { if s.is_null() { return 0; @@ -413,6 +411,7 @@ pub unsafe fn dc_free_splitted_lines(lines: Vec<*mut libc::c_char>) { } /* insert a break every n characters, the return must be free()'d */ +#[cfg(test)] unsafe fn dc_insert_breaks( in_0: *const libc::c_char, break_every: libc::c_int, diff --git a/src/lib.rs b/src/lib.rs index 8ac561b2b..76cacfd37 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -65,7 +65,5 @@ mod dc_strencode; mod dc_token; pub mod dc_tools; -use self::constants::*; - #[cfg(test)] mod test_utils; diff --git a/src/types.rs b/src/types.rs index 93fbd973d..41f9bb50f 100644 --- a/src/types.rs +++ b/src/types.rs @@ -34,14 +34,9 @@ pub type dc_precheck_imf_t = pub type dc_set_config_t = fn(_: &Context, _: &str, _: Option<&str>) -> (); pub type dc_get_config_t = fn(_: &Context, _: &str) -> Option; -type sqlite_int64 = i64; -type sqlite3_int64 = sqlite_int64; - pub type int32_t = i32; -type int64_t = i64; pub type uintptr_t = libc::uintptr_t; pub type size_t = libc::size_t; -type ssize_t = libc::ssize_t; pub type uint32_t = libc::c_uint; pub type uint8_t = libc::c_uchar; pub type uint16_t = libc::c_ushort;