Remove dead code

This commit is contained in:
Dmitry Bogatov
2019-08-16 04:19:58 +00:00
parent ea661896a1
commit 7c7a1b64df
7 changed files with 8 additions and 21 deletions

View File

@@ -1,5 +1,5 @@
//! Constants
#![allow(non_camel_case_types)]
#![allow(non_camel_case_types, dead_code)]
use lazy_static::lazy_static;

View File

@@ -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());

View File

@@ -61,11 +61,6 @@ pub struct dc_mimeparser_t<'a> {
pub message_kml: Option<dc_kml_t>,
}
// 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;

View File

@@ -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,

View File

@@ -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,

View File

@@ -65,7 +65,5 @@ mod dc_strencode;
mod dc_token;
pub mod dc_tools;
use self::constants::*;
#[cfg(test)]
mod test_utils;

View File

@@ -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<String>;
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;