From dd4adb57cfea52fe2505fc818b3860ea129d88f3 Mon Sep 17 00:00:00 2001 From: dignifiedquire Date: Thu, 26 Sep 2019 00:45:20 +0200 Subject: [PATCH] refactor(mmime): remove some duplication --- mmime/src/mailimf/types.rs | 7 +++---- mmime/src/mailmime/decode.rs | 5 +---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/mmime/src/mailimf/types.rs b/mmime/src/mailimf/types.rs index 99ddf068c..ad6b849ae 100644 --- a/mmime/src/mailimf/types.rs +++ b/mmime/src/mailimf/types.rs @@ -43,15 +43,14 @@ pub struct mailimf_date_time { pub dt_zone: libc::c_int, } /* this is the type of address */ -pub type unnamed = libc::c_uint; /* if this is a group (group_name: address1@domain1, address2@domain2; ) */ -pub const MAILIMF_ADDRESS_GROUP: unnamed = 2; +pub const MAILIMF_ADDRESS_GROUP: libc::c_uint = 2; /* if this is a mailbox (mailbox@domain) */ -pub const MAILIMF_ADDRESS_MAILBOX: unnamed = 1; +pub const MAILIMF_ADDRESS_MAILBOX: libc::c_uint = 1; /* on parse error */ -pub const MAILIMF_ADDRESS_ERROR: unnamed = 0; +pub const MAILIMF_ADDRESS_ERROR: libc::c_uint = 0; /* mailimf_address is an address diff --git a/mmime/src/mailmime/decode.rs b/mmime/src/mailmime/decode.rs index 1bdb4dfcf..3754d8187 100644 --- a/mmime/src/mailmime/decode.rs +++ b/mmime/src/mailmime/decode.rs @@ -8,9 +8,6 @@ use crate::mailmime::types::*; use crate::mmapstring::*; use crate::other::*; -pub const MAIL_CHARCONV_ERROR_CONV: libc::c_uint = 3; -pub const MAIL_CHARCONV_ERROR_UNKNOWN_CHARSET: libc::c_uint = 1; -pub const MAIL_CHARCONV_ERROR_MEMORY: libc::c_uint = 2; pub const TYPE_WORD: libc::c_uint = 1; pub const TYPE_ENCODED_WORD: libc::c_uint = 2; pub const MAILMIME_ENCODING_Q: libc::c_uint = 1; @@ -850,7 +847,7 @@ unsafe fn mailmime_etoken_parse( return mailimf_custom_string_parse(message, length, indx, result, Some(is_etoken_char)); } -pub unsafe fn is_etoken_char(mut ch: libc::c_char) -> libc::c_int { +unsafe fn is_etoken_char(mut ch: libc::c_char) -> libc::c_int { let mut uch: libc::c_uchar = ch as libc::c_uchar; if (uch as libc::c_int) < 31i32 { return 0i32;