From ac12b2e6434b98163ebb64cf0ed97c459c39959f Mon Sep 17 00:00:00 2001 From: Alexander Krotov Date: Sun, 15 Sep 2019 17:32:16 +0000 Subject: [PATCH] chore(key): remove unused *fingerprint_c functions --- src/key.rs | 30 ------------------------------ 1 file changed, 30 deletions(-) diff --git a/src/key.rs b/src/key.rs index 0262750c2..9afc8ff43 100644 --- a/src/key.rs +++ b/src/key.rs @@ -1,5 +1,4 @@ use std::collections::BTreeMap; -use std::ffi::{CStr, CString}; use std::io::Cursor; use std::path::Path; @@ -12,7 +11,6 @@ use crate::constants::*; use crate::context::Context; use crate::dc_tools::*; use crate::sql::{self, Sql}; -use crate::x::*; #[derive(Debug, PartialEq, Eq, Clone)] pub enum Key { @@ -235,23 +233,11 @@ impl Key { } } - pub fn fingerprint_c(&self) -> *mut libc::c_char { - let res = CString::new(self.fingerprint()).unwrap(); - - unsafe { strdup(res.as_ptr()) } - } - pub fn formatted_fingerprint(&self) -> String { let rawhex = self.fingerprint(); dc_format_fingerprint(&rawhex) } - pub fn formatted_fingerprint_c(&self) -> *mut libc::c_char { - let res = CString::new(self.formatted_fingerprint()).unwrap(); - - unsafe { strdup(res.as_ptr()) } - } - pub fn split_key(&self) -> Option { match self { Key::Public(_) => None, @@ -297,14 +283,6 @@ pub fn dc_format_fingerprint(fingerprint: &str) -> String { res } -pub fn dc_format_fingerprint_c(fp: *const libc::c_char) -> *mut libc::c_char { - let input = unsafe { CStr::from_ptr(fp).to_str().unwrap() }; - let res = dc_format_fingerprint(input); - let res_c = CString::new(res).unwrap(); - - unsafe { strdup(res_c.as_ptr()) } -} - /// Bring a human-readable or otherwise formatted fingerprint back to the 40-characters-uppercase-hex format. pub fn dc_normalize_fingerprint(fp: &str) -> String { fp.to_uppercase() @@ -313,14 +291,6 @@ pub fn dc_normalize_fingerprint(fp: &str) -> String { .collect() } -pub fn dc_normalize_fingerprint_c(fp: *const libc::c_char) -> *mut libc::c_char { - let input = unsafe { CStr::from_ptr(fp).to_str().unwrap() }; - let res = dc_normalize_fingerprint(input); - let res_c = CString::new(res).unwrap(); - - unsafe { strdup(res_c.as_ptr()) } -} - #[cfg(test)] mod tests { use super::*;